-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot access inputs.self.outPath
in top level imports
#148
Comments
Workaround 2Instead of # flake.nix
{
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({inputs, ...}: {
imports = [
./my-module.nix
];
});
} |
It's not equivalent when your flake is used in another flake |
inputs.self.outPath
inputs.self.outPath
in top level imports
So I guess you're writing a framework with a fixed location for a flake module then? With the Nix we have, you can only Workaround 3, perSystem onlyMaybe this helps you or someone. # flake.nix
{
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
outputs = inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({inputs, ...}: {
perSystem = {
imports = [
"${inputs.self.outPath}/my-module.nix"
];
};
});
} Workaround 4, specialArgs
Users would call mkFlake { inherit inputs; specialArgs.root = ./.; } <module> You would write a module such as { root, ... }:
{
imports = [ (root + "/my-module.nix") ];
} |
See also my investigation of this in #137. I should probably extract that commit set out into its own PR. |
Given
When running
Got
Root cause
NixOS/nix#8300
Workaround
The text was updated successfully, but these errors were encountered: