about summary refs log tree commit diff
path: root/nixos/modules/installer/tools/tools.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/installer/tools/tools.nix')
-rw-r--r--nixos/modules/installer/tools/tools.nix42
1 files changed, 15 insertions, 27 deletions
diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix
index 0a01d6bb9b69..0887dd56a67e 100644
--- a/nixos/modules/installer/tools/tools.nix
+++ b/nixos/modules/installer/tools/tools.nix
@@ -106,11 +106,12 @@ let
       #   isNormalUser = true;
       #   extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
       #   packages = with pkgs; [
-      #     firefox
       #     tree
       #   ];
       # };
 
+      # programs.firefox.enable = true;
+
       # List packages installed in system profile. To search, run:
       # \$ nix search wget
       # environment.systemPackages = with pkgs; [
@@ -216,7 +217,7 @@ in
   imports = let
     mkToolModule = { name, package ? pkgs.${name} }: { config, ... }: {
       options.system.tools.${name}.enable = lib.mkEnableOption "${name} script" // {
-        default = true;
+        default = config.nix.enable && ! config.system.disableInstallerTools;
         internal = true;
       };
 
@@ -227,34 +228,21 @@ in
   in [
     (mkToolModule { name = "nixos-build-vms"; })
     (mkToolModule { name = "nixos-enter"; })
-    (mkToolModule { name = "nixos-generate-config"; package = nixos-generate-config; })
-    (mkToolModule { name = "nixos-install"; package = nixos-install; })
+    (mkToolModule { name = "nixos-generate-config"; package = config.system.build.nixos-generate-config; })
+    (mkToolModule { name = "nixos-install"; package = config.system.build.nixos-install; })
     (mkToolModule { name = "nixos-option"; })
-    (mkToolModule { name = "nixos-rebuild"; package = nixos-rebuild; })
+    (mkToolModule { name = "nixos-rebuild"; package = config.system.build.nixos-rebuild; })
     (mkToolModule { name = "nixos-version"; package = nixos-version; })
   ];
 
-  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;
-      };
-    })
-    {
-      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;
+    };
+  };
 }