From ba3e5b02f6114c253bda6f54725b8fdc7914dfa2 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Sat, 2 Nov 2024 18:18:37 +0100 Subject: [PATCH 1/2] nixos/tools: set the enable options with mkDefault This makes it easier to enable some of them again. --- nixos/modules/installer/tools/tools.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 6e3e2eb475f3d..19b42c391abd2 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -238,13 +238,13 @@ in config = lib.mkMerge [ (lib.mkIf config.system.disableInstallerTools { system.tools = { - nixos-build-vms.enable = false; - nixos-enter.enable = false; - nixos-generate-config.enable = false; - nixos-install.enable = false; - nixos-option.enable = false; - nixos-rebuild.enable = false; - nixos-version.enable = false; + nixos-build-vms.enable = lib.mkDefault false; + nixos-enter.enable = lib.mkDefault false; + nixos-generate-config.enable = lib.mkDefault false; + nixos-install.enable = lib.mkDefault false; + nixos-option.enable = lib.mkDefault false; + nixos-rebuild.enable = lib.mkDefault false; + nixos-version.enable = lib.mkDefault false; }; }) { From 2eb92f4063a3714d8168ef0669139be8abdbcffd Mon Sep 17 00:00:00 2001 From: r-vdp Date: Sat, 2 Nov 2024 19:03:29 +0100 Subject: [PATCH 2/2] fixup! nixos/tools: set the enable options with mkDefault --- nixos/modules/installer/tools/tools.nix | 33 ++++++++----------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 19b42c391abd2..34526c1b20a36 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -217,7 +217,7 @@ in imports = let mkToolModule = { name, package ? pkgs.${name} }: { config, ... }: { options.system.tools.${name}.enable = lib.mkEnableOption "${name} script" // { - default = config.nix.enable; + default = config.nix.enable && ! config.system.disableInstallerTools; internal = true; }; @@ -235,27 +235,14 @@ in (mkToolModule { name = "nixos-version"; package = nixos-version; }) ]; - config = lib.mkMerge [ - (lib.mkIf config.system.disableInstallerTools { - system.tools = { - nixos-build-vms.enable = lib.mkDefault false; - nixos-enter.enable = lib.mkDefault false; - nixos-generate-config.enable = lib.mkDefault false; - nixos-install.enable = lib.mkDefault false; - nixos-option.enable = lib.mkDefault false; - nixos-rebuild.enable = lib.mkDefault false; - nixos-version.enable = lib.mkDefault false; - }; - }) - { - documentation.man.man-db.skipPackages = [ nixos-version ]; + config = { + documentation.man.man-db.skipPackages = [ nixos-version ]; - # These may be used in auxiliary scripts (ie not part of toplevel), so they are defined unconditionally. - system.build = { - inherit nixos-generate-config nixos-install nixos-rebuild; - nixos-option = lib.warn "Accessing nixos-option through `config.system.build` is deprecated, use `pkgs.nixos-option` instead." pkgs.nixos-option; - nixos-enter = lib.warn "Accessing nixos-enter through `config.system.build` is deprecated, use `pkgs.nixos-enter` instead." pkgs.nixos-enter; - }; - } - ]; + # These may be used in auxiliary scripts (ie not part of toplevel), so they are defined unconditionally. + system.build = { + inherit nixos-generate-config nixos-install nixos-rebuild; + nixos-option = lib.warn "Accessing nixos-option through `config.system.build` is deprecated, use `pkgs.nixos-option` instead." pkgs.nixos-option; + nixos-enter = lib.warn "Accessing nixos-enter through `config.system.build` is deprecated, use `pkgs.nixos-enter` instead." pkgs.nixos-enter; + }; + }; }