-
Notifications
You must be signed in to change notification settings - Fork 122
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
export module as system-independent flake output #8
Conversation
I'm okay breaking a handful of people now to get the output to be standard. |
Flake outputs are a mixture of system-dependent and system-independent sets, and flake-utils doesn't do much to distinguish one from the other. Because of that, the `age` NixOS module currently has to be acessed as `agenix.nixosModules.${system}.age`, rather than the documented `agenix.nixosModules.age`. To remedy that, (conceptually) split `outputs` in two, let flake-utils handle the system-dependent half, and merge them to form the actual outputs. The names for the two halves were taken from [1]. [1]: NixOS/nix#3843 (comment)
bd3d8e8
to
c1cbfe7
Compare
Done. It should match the README now. |
Thanks. When I run $ nix --version
nix (Nix) 2.4pre20201102_550e11f
$ nix flake show
warning: unknown setting 'extra-sandbox-paths'
git+file:///home/ryantm/p/agenix?ref=flake-nixos-module&rev=c1cbfe75b0e2b26fa0918c5634d13c8364d04599
├───defaultPackage
│ ├───aarch64-linux: package 'agenix'
│ ├───i686-linux: package 'agenix'
│ ├───x86_64-darwin: package 'agenix'
│ └───x86_64-linux: package 'agenix'
├───nixosModules
│ └───age: NixOS module
└───packages
├───aarch64-linux
│ ├───agenix: package 'agenix'
error: --- Error ---------------------------------------------------------------------------------------------------------------------------- nix
expected a derivation Do you get this error? I'll try upgrading my version of Nix. |
Still happens on a later version $ nix --version
nix (Nix) 2.4pre20201201_5a6ddb3
[ryantm@home1:~/p/agenix]$ nix flake show --show-trace
git+file:///home/ryantm/p/agenix?ref=flake-nixos-module&rev=c1cbfe75b0e2b26fa0918c5634d13c8364d04599
├───defaultPackage
│ ├───aarch64-linux: package 'agenix'
│ ├───i686-linux: package 'agenix'
│ ├───x86_64-darwin: package 'agenix'
│ └───x86_64-linux: package 'agenix'
├───nixosModules
│ └───age: NixOS module
└───packages
├───aarch64-linux
│ ├───agenix: package 'agenix'
error: --- Error --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
expected a derivation |
Yeah, it already happened before this PR. I elided it from my original post because it wasn't relevant to the module thing. Replicating the
I suspect Nix is choking on |
(As far I can tell it works fine, just not when doing |
Okay, I'm glad it isn't just me. Merged! |
The example in the README uses
agenix.nixosModules.age
as the NixOS module, but that causes an "attribute 'age' missing" error for me. I've had to useagenix.nixosModules.x86_64-linux.age
instead.nix flake show
sees no module in there either:This is because flake-utils doesn't try to distinguish outputs with
${system}
keys from those without.In my own flakes I've been using a pattern inspired by this idea for system-dependent and system-independent outputs, and it's the same pattern I'm using in this PR.
Because someone may already be using the current paths, I've kept
nixosModules
as is, and added a singularnixosModule
output, which isn't recognized bynix flake show
but is documented in the wiki. Alternatively I can changenixosModules
to match the documentation,I'm marking this as WIP because the README needs to be updated based on the previous paragraph.