Skip to content

Commit

Permalink
nixos/tools: set the default for the enable options (#353175)
Browse files Browse the repository at this point in the history
  • Loading branch information
K900 authored Nov 3, 2024
2 parents 8cf0d3a + 2eb92f4 commit d0d0a08
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions nixos/modules/installer/tools/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -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 = 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;
};
};
}

0 comments on commit d0d0a08

Please sign in to comment.