Nix: ~/.config/nix/nix.conf overrides values of /etc/nix/nix.conf

Created on 10 May 2018  路  9Comments  路  Source: NixOS/nix

I'd expect substituters in ~/.config/nix/nix.conf to be appended on top of the system /etc/nix/nix.conf, but currently, Nix overrides them.

Most helpful comment

I'm not sure if append is desirable behaviour in general. What if you want to override? Also, should it prepend or append?

Maybe appending could be a special syntax, e.g.

substituters += https://...

or --substituters +https://....

All 9 comments

There's extra-substituters, same for certain other options.

I'm not sure if append is desirable behaviour in general. What if you want to override? Also, should it prepend or append?

Maybe appending could be a special syntax, e.g.

substituters += https://...

or --substituters +https://....

For the command line syntax, the GNU command line guidelines for long options generally supports --foo=bar to be equivalent to --foo bar. So if we supported that, then --substituters+=https://foo.bar would be a quite logical extension.

Additionally, it'd be nice if there were ways to specify many config files other than the two default ones.

Configuration files can use import to load additional config files. Does that suit your needs, @ElvishJerricco?

@grahamc Had no idea.That's awesome. Is that documented? And I assume it still causes overwriting of options?

Oops, I meant include -- yes it is documented: https://nixos.org/nix/manual/#description-41

Using += seems fine to me as long as there's an equivalent for --options substituters ..., something like --options-append substituters ...

I just ran into a very confusing issue where I had a shell alias in a shellHook with multiple --option trusted-public-keys options.
Suddenly my machine was recompiling the linux kernel after a nixpkgs upgrade. I couldn't figure out what was wrong until @domenkozar pointed out that --option trusted-public-keys overrides instead of appending. So :+1: on this issue!

Was this page helpful?
0 / 5 - 0 ratings