Skip to content
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

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

Open
supermarin opened this issue Oct 17, 2023 · 2 comments
Open

Comments

@supermarin
Copy link

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.

supermarin added a commit to supermarin/dotfiles that referenced this issue Oct 17, 2023
There are a few problems:
  1. agenix decrypts at activation time, so /run/agenix/nixConf isn't
     there when nix evaluates configuration.nix and checks contents of
     nix.conf which references /run/agenix/nixConf.

  2. agenix's homeManagerModules module collides with it's nixosModules.
     This makes it impossible to load both at the same time and use
     home-manager to put the secret in the user's nix.conf
     [gh issue](ryantm/agenix#215)

  3. symlinking is broken ATM
     [gh issue](ryantm/agenix#214)
supermarin added a commit to supermarin/dotfiles that referenced this issue Oct 17, 2023
There are a few problems:
  1. agenix decrypts at activation time, so /run/agenix/nixConf isn't
     there when nix evaluates configuration.nix and checks contents of
     nix.conf which references /run/agenix/nixConf.

  2. agenix's homeManagerModules module collides with it's nixosModules.
     This makes it impossible to load both at the same time and use
     home-manager to put the secret in the user's nix.conf
     [gh issue](ryantm/agenix#215)

  3. symlinking is broken ATM
     [gh issue](ryantm/agenix#214)
@ambroisie
Copy link
Contributor

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

@ambroisie
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants