home-manager/tests/modules/misc/nix/keep-old-nix-path.nix
midchildan 8d5e27b480
nix: add a declarative alternative to Nix channels (#4031)
* nix: add options 'nixPath' and 'keepOldNixPath'

By default, the system value for $NIX_PATH is kept as a fallback.
To completely override the system value for $NIX_PATH:

    nix.keepOldNixPath = false;

* nix: add more tests

* nix: add a declarative alternative to Nix channels

This adds a new option, 'nix.channels'. It's the Nix channels equivalent
of the 'nix.registry' option, and compatible with pre-Flake Nix tooling
including nix-env and nix-shell. Like 'nix.registry', this option is
useful for pinning Nix channels.

Channels defined in the new option can coexist with channels introduced
through the nix-channel command. If the same channel exists in both, the
one from Home Manager will be prioritized.

* nix: add news entry

* nix: make channels respect use-xdg-base-directories

* nix: remove 'with lib;'

---------

Co-authored-by: Michael Hoang <enzime@users.noreply.github.com>
2024-06-13 01:47:38 +00:00

16 lines
308 B
Nix

{ config, ... }:
{
config = {
nix = {
package = config.lib.test.mkStubPackage { };
nixPath = [ "/a" "/b/c" ];
keepOldNixPath = false;
};
nmt.script = ''
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export NIX_PATH="/a:/b/c"'
'';
};
}