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

Set nix path using home manager when not using nixos #27

Open
amardeep opened this issue Mar 23, 2023 · 2 comments
Open

Set nix path using home manager when not using nixos #27

amardeep opened this issue Mar 23, 2023 · 2 comments

Comments

@amardeep
Copy link

I would like non-flake nix commands to refer to same nixpkgs version as the flake.

I am guessing right now it is done in standard/nixos/configuration.nix

nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;

How to do this in home manager when not running on nixos? I am using nix on macos and not using nix-darwin

@Misterio77
Copy link
Owner

Hey!

NixOS implements nix.nixPath by setting the NIX_PATH environment variable:
https://github.com/NixOS/nixpkgs/blob/9ef6e7727f4c31507627815d4f8679c5841efb00/nixos/modules/services/misc/nix-daemon.nix#L796

Home manager does not currently have this abstraction, but perhaps you should be able to do the same using home.sessionVariables; maybe even make this a contribution to hm?

@amardeep
Copy link
Author

Thanks,

For now, my issue is solved by adding the following section:

    home.sessionVariables = {
      NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
    };

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