-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
nixos/nix: add support for specifying additional nix paths #63201
base: master
Are you sure you want to change the base?
Conversation
It is a common pitfall for NixOS users to declare some additional nix search paths by setting `nix.nixPath` not noticing that they are removing the default search paths. This change introduces the option `nix.extraNixPath` which can be used to add paths to the list of search paths without overriding the defaults. Users most likely want to use this since it is less likely they'll have to resort fiddling the `NIX_PATH` environment variable themselvs in order to repair their system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the solution, but the implementation seems good.
@lheckemann what would be a better solution? |
Replacing |
I don't see how flakes will be able to replace the include paths at all. It might work for custom package sources but not for things like passing extra inputs to your builds. The user we encountered on the weekend had to use it to pass some SSH configuration into the build process. Also being able to use |
Do not we have some functor that would modify list merge rule? E.g. |
Maybe `mkAfter [...] `?
…On Mon, 17 Jun 2019, 11:03 Jan Tojnar, ***@***.***> wrote:
Do not we have some functor that would modify list merge rule?
E.g. option = mergeList [ foo ]; vs. option = mkForce xxx [ foo ]
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#63201?email_source=notifications&email_token=AAE365BLYC74HLVBP6P5OLDP25HN5A5CNFSM4HYQ6BWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX2QU2I#issuecomment-502598249>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAE365FSHGOYMPNHUDAY32TP25HN5ANCNFSM4HYQ6BWA>
.
|
{lib, ...}: {
nix = {
nixPath = lib.mkOptionDefault [
"nixpkgs=/home/jtojnar/Projects/nixpkgs"
];
};
} $ nixos-option -I nixos-config=/etc/nixos/configuration.nix nix.nixPath
Value:
[ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" "nixos-config=/etc/nixos/configuration.nix" "/nix/var/nix/profiles/per-user/root/channels" "nixpkgs=/home/jtojnar/Projects/nixpkgs" ]
Default:
[ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" "nixos-config=/etc/nixos/configuration.nix" "/nix/var/nix/profiles/per-user/root/channels" ] |
An alternative would be moving the default value from |
IMHO we should avoid ad hoc
Maybe using |
I agree with @edolstra about |
Thank you for your contributions.
|
Still something I want to get back to eventually.. Keeping this open serves as a todo item for me. |
I marked this as stale due to inactivity. → More info |
Is this still an issue to resolve? What happens when |
It is a common pitfall for NixOS users to declare some additional nix
search paths by setting
nix.nixPath
not noticing that they areremoving the default search paths.
This change introduces the option
nix.extraNixPath
which can be usedto add paths to the list of search paths without overriding the
defaults. Users most likely want to use this since it is less likely
they'll have to resort fiddling the
NIX_PATH
environment variablethemselves in order to repair their system.
/cc @lheckemann @flokli since we just helped a NixOS users at ZuriHack with recovering from such a situation.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)This change is