Merge pull request #122784 from hercules-ci/nixpkgs-init-nixos-install-tools
nixos-install-tools: init
This commit is contained in:
commit
74bf82a202
3 changed files with 73 additions and 4 deletions
|
@ -84,12 +84,12 @@ nixpkgs https://nixos.org/channels/nixpkgs-unstable</screen>
|
|||
</para>
|
||||
<para>
|
||||
You'll need <literal>nixos-generate-config</literal> and
|
||||
<literal>nixos-install</literal> and we'll throw in some man pages and
|
||||
<literal>nixos-enter</literal> just in case you want to chroot into your
|
||||
NixOS partition. They are installed by default on NixOS, but you don't have
|
||||
<literal>nixos-install</literal>, but this also makes some man pages
|
||||
and <literal>nixos-enter</literal> available, just in case you want to chroot into your
|
||||
NixOS partition. NixOS installs these by default, but you don't have
|
||||
NixOS yet..
|
||||
</para>
|
||||
<screen><prompt>$ </prompt>nix-env -f '<nixpkgs/nixos>' --arg configuration {} -iA config.system.build.{nixos-generate-config,nixos-install,nixos-enter,manual.manpages}</screen>
|
||||
<screen><prompt>$ </prompt>nix-env -f '<nixpkgs>' -iA nixos-install-tools</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<note>
|
||||
|
|
67
pkgs/tools/nix/nixos-install-tools/default.nix
Normal file
67
pkgs/tools/nix/nixos-install-tools/default.nix
Normal file
|
@ -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";
|
||||
})
|
|
@ -30448,6 +30448,8 @@ in
|
|||
(import ../../nixos/lib/make-options-doc/default.nix)
|
||||
({ inherit pkgs lib; } // attrs);
|
||||
|
||||
nixos-install-tools = callPackage ../tools/nix/nixos-install-tools { };
|
||||
|
||||
nixui = callPackage ../tools/package-management/nixui { node_webkit = nwjs_0_12; };
|
||||
|
||||
nixdoc = callPackage ../tools/nix/nixdoc {};
|
||||
|
|
Loading…
Reference in a new issue