From cd049bfdf64d29a2b4859b8e146bb9b448d657ff Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Thu, 29 Mar 2018 21:00:49 +0200 Subject: [PATCH] nix: use pkgs.nix by default instead of the default profile This fixes version detection for 2.0. --- modules/nix/default.nix | 11 +++++++++-- modules/system/version.nix | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 09975096..540f84df 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -53,10 +53,14 @@ in options = { nix.package = mkOption { type = types.either types.package types.path; - default = "/nix/var/nix/profiles/default"; - example = "pkgs.nix"; + default = pkgs.nix; + defaultText = "pkgs.nix"; + example = "pkgs.nixUnstable"; description = '' This option specifies the package or profile that contains the version of Nix to use throughout the system. + To keep the version of nix originally installed the default profile can be used. + + eg. /nix/var/nix/profiles/default ''; }; @@ -331,6 +335,9 @@ in "/nix/var/nix/profiles/per-user/root/channels" ]); + nix.package = mkIf (config.system.stateVersion < 3) + "/nix/var/nix/profiles/default"; + environment.systemPackages = mkIf (isDerivation cfg.package) [ cfg.package ]; diff --git a/modules/system/version.nix b/modules/system/version.nix index 72aeea77..5dda0db4 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -18,7 +18,7 @@ in options = { system.stateVersion = mkOption { type = types.int; - default = 2; + default = 3; description = '' Every once in a while, a new NixOS release may change configuration defaults in a way incompatible with stateful