diff --git a/nixos/modules/config/nix-channel.nix b/nixos/modules/config/nix-channel.nix index 4d6e19975508..583052aebdb7 100644 --- a/nixos/modules/config/nix-channel.nix +++ b/nixos/modules/config/nix-channel.nix @@ -42,7 +42,7 @@ in }; }; - nixPath = mkOption { + settings.nix-path = mkOption { type = types.listOf types.str; default = if cfg.channel.enable then @@ -80,8 +80,11 @@ in }; }; - config = mkIf cfg.enable { + imports = [ + (lib.mkRenamedOptionModule [ "nix" "nixPath" ] [ "nix" "settings" "nix-path" ]) + ]; + config = mkIf cfg.enable { environment.extraInit = mkIf cfg.channel.enable '' if [ -e "$HOME/.nix-defexpr/channels" ]; then export NIX_PATH="$HOME/.nix-defexpr/channels''${NIX_PATH:+:$NIX_PATH}" @@ -95,7 +98,7 @@ in # NIX_PATH has a non-empty default according to Nix docs, so we don't unset # it when empty. environment.sessionVariables = { - NIX_PATH = cfg.nixPath; + NIX_PATH = cfg.settings.nix-path; }; systemd.tmpfiles.rules = lib.mkIf cfg.channel.enable [ diff --git a/nixos/modules/misc/nixpkgs-flake.nix b/nixos/modules/misc/nixpkgs-flake.nix index 10549999fd7b..d192c3e1735d 100644 --- a/nixos/modules/misc/nixpkgs-flake.nix +++ b/nixos/modules/misc/nixpkgs-flake.nix @@ -102,7 +102,7 @@ in # because we would need some kind of evil shim taking the *calling* flake's self path, # perhaps, to ever make that work (in order to know where the Nix expr for the system came # from and how to call it). - nix.nixPath = lib.mkDefault ( + nix.settings.nix-path = lib.mkDefault ( [ "nixpkgs=flake:nixpkgs" ] ++ lib.optional config.nix.channel.enable "/nix/var/nix/profiles/per-user/root/channels" ); diff --git a/nixos/tests/nix-required-mounts/default.nix b/nixos/tests/nix-required-mounts/default.nix index 267d077583b3..18f04a5f7d28 100644 --- a/nixos/tests/nix-required-mounts/default.nix +++ b/nixos/tests/nix-required-mounts/default.nix @@ -12,10 +12,12 @@ in { virtualisation.writableStore = true; system.extraDependencies = [ (pkgs.runCommand "deps" { } "mkdir $out").inputDerivation ]; - nix.nixPath = [ "nixpkgs=${../../..}" ]; - nix.settings.substituters = lib.mkForce [ ]; - nix.settings.system-features = [ "supported-feature" ]; - nix.settings.experimental-features = [ "nix-command" ]; + nix.settings = { + experimental-features = [ "nix-command" ]; + nix-path = [ "nixpkgs=${../../..}" ]; + substituters = lib.mkForce [ ]; + system-features = [ "supported-feature" ]; + }; nix.enable = true; # disabled by default. See all-tests.nix / tag(no-nix-by-default) programs.nix-required-mounts.enable = true; programs.nix-required-mounts.allowedPatterns.supported-feature = {