ryantm / agenix

age-encrypted secrets for NixOS and Home manager
https://matrix.to/#/#agenix:nixos.org
Creative Commons Zero v1.0 Universal
1.33k stars 106 forks source link

Using both nixosModules.default and homeManagerModules.default errors #215

Open supermarin opened 8 months ago

supermarin commented 8 months ago

As a part of trying to make nixAccessToken via secret file working, I reverted to create ~/.config/nix/nix.conf via home-manager and moved the logic to home.nix. As soon as you add agenix.homeManagerModules.default below agenix.nixosModules.default in flake.nix modules section of nixpkgs.lib.nixosSystem, this error gets thrown at you:

       error: The option `age.identityPaths' in `/nix/store/xi1ibzxvjm7k1yb2mywszm14cyh59x85-source/flake.nix' is already declared in `/nix/store/xi1ibzxvjm7k1yb2mywszm14cyh59x85-source/flake.nix'.

It'd be awesome to document how to properly use HM module and user secrets alongside system secrets.

ambroisie commented 7 months ago

I'm not having any issue with using both at the same time. Check out my config here (home-manager) and here (NixOS).

ambroisie commented 7 months ago

More specifically, I think your issue is that your either trying to import the HM module in NixOS, or vice-versa. Each should only be imported in their respective configuration.