diff options
author | Robert Hensing <robert@roberthensing.nl> | 2021-05-12 22:11:17 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2021-05-13 01:29:02 +0200 |
commit | 7b0e0ca35e07a3043f2427e96d5f10478fdc5597 (patch) | |
tree | b1c30775c0060912cac8c33a1c02393791a5cdda /pkgs/tools/nix/nixos-install-tools | |
parent | 75c4fc1c8bf1c4c453c2b7279d70dc058d0b60ba (diff) | |
download | nixpkgs-7b0e0ca35e07a3043f2427e96d5f10478fdc5597.tar nixpkgs-7b0e0ca35e07a3043f2427e96d5f10478fdc5597.tar.gz nixpkgs-7b0e0ca35e07a3043f2427e96d5f10478fdc5597.tar.bz2 nixpkgs-7b0e0ca35e07a3043f2427e96d5f10478fdc5597.tar.lz nixpkgs-7b0e0ca35e07a3043f2427e96d5f10478fdc5597.tar.xz nixpkgs-7b0e0ca35e07a3043f2427e96d5f10478fdc5597.tar.zst nixpkgs-7b0e0ca35e07a3043f2427e96d5f10478fdc5597.zip |
nixos-install-tools: init
The essential commands from the NixOS installer as a package With this package, you get the commands like nixos-generate-config and nixos-install that you would otherwise only find on a NixOS system, such as an installer image. This way, you can install NixOS using a machine that only has Nix. It also includes the manpages, which are important because the commands rely on those for providing --help.
Diffstat (limited to 'pkgs/tools/nix/nixos-install-tools')
-rw-r--r-- | pkgs/tools/nix/nixos-install-tools/default.nix | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/tools/nix/nixos-install-tools/default.nix b/pkgs/tools/nix/nixos-install-tools/default.nix new file mode 100644 index 00000000000..a129fb34521 --- /dev/null +++ b/pkgs/tools/nix/nixos-install-tools/default.nix @@ -0,0 +1,67 @@ +{ + buildEnv, + lib, + man, + nixos, + # TODO: replace indirect self-reference by proper self-reference + # https://github.com/NixOS/nixpkgs/pull/119942 + nixos-install-tools, + runCommand, +}: +let + inherit (nixos {}) config; + version = config.system.nixos.version; +in +(buildEnv { + name = "nixos-install-tools-${version}"; + paths = lib.attrValues { + # See nixos/modules/installer/tools/tools.nix + inherit (config.system.build) + nixos-install nixos-generate-config nixos-enter; + + # Required for --help. + inherit (config.system.build.manual) manpages; + }; + + extraOutputsToInstall = ["man"]; + + meta = { + description = "The essential commands from the NixOS installer as a package"; + longDescription = '' + With this package, you get the commands like nixos-generate-config and + nixos-install that you would otherwise only find on a NixOS system, such + as an installer image. + + This way, you can install NixOS using a machine that only has Nix. + ''; + license = lib.licenses.mit; + homepage = "https://nixos.org"; + platforms = lib.platforms.linux; + }; + + passthru.tests = { + nixos-install-help = runCommand "test-nixos-install-help" { + nativeBuildInputs = [ + man + nixos-install-tools + ]; + meta.description = '' + Make sure that --help works. It's somewhat non-trivial because it + requires man. + ''; + } '' + nixos-install --help | grep -F 'NixOS Reference Pages' + nixos-install --help | grep -F 'configuration.nix' + nixos-generate-config --help | grep -F 'NixOS Reference Pages' + nixos-generate-config --help | grep -F 'hardware-configuration.nix' + + # FIXME: Tries to call unshare, which it must not do for --help + # nixos-enter --help | grep -F 'NixOS Reference Pages' + + touch $out + ''; + }; +}).overrideAttrs (o: { + inherit version; + pname = "nixos-install-tools"; +}) |