forked from mirrors/nixpkgs
nixos-containers: init package (#16959)
This moves nixos-containers into its own package so that it can be relied upon by other packages/systems. This should make development using dynamic containers much easier.
This commit is contained in:
parent
e2199205c7
commit
eb92804f91
|
@ -4,22 +4,6 @@ with lib;
|
|||
|
||||
let
|
||||
|
||||
nixos-container = pkgs.substituteAll {
|
||||
name = "nixos-container";
|
||||
dir = "bin";
|
||||
isExecutable = true;
|
||||
src = ./nixos-container.pl;
|
||||
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
|
||||
su = "${pkgs.shadow.su}/bin/su";
|
||||
inherit (pkgs) utillinux;
|
||||
|
||||
postInstall = ''
|
||||
t=$out/etc/bash_completion.d
|
||||
mkdir -p $t
|
||||
cp ${./nixos-container-completion.sh} $t/nixos-container
|
||||
'';
|
||||
};
|
||||
|
||||
# The container's init script, a small wrapper around the regular
|
||||
# NixOS stage-2 init script.
|
||||
containerInit = pkgs.writeScript "container-init"
|
||||
|
@ -410,7 +394,7 @@ in
|
|||
ExecReload = pkgs.writeScript "reload-container"
|
||||
''
|
||||
#! ${pkgs.stdenv.shell} -e
|
||||
${nixos-container}/bin/nixos-container run "$INSTANCE" -- \
|
||||
${pkgs.nixos-container}/bin/nixos-container run "$INSTANCE" -- \
|
||||
bash --login -c "''${SYSTEM_PATH:-/nix/var/nix/profiles/system}/bin/switch-to-configuration test"
|
||||
'';
|
||||
|
||||
|
@ -498,6 +482,6 @@ in
|
|||
|
||||
networking.dhcpcd.denyInterfaces = [ "ve-*" ];
|
||||
|
||||
environment.systemPackages = [ nixos-container ];
|
||||
environment.systemPackages = [ pkgs.nixos-container ];
|
||||
});
|
||||
}
|
||||
|
|
17
pkgs/tools/virtualization/nixos-container/default.nix
Normal file
17
pkgs/tools/virtualization/nixos-container/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ substituteAll, perl, perlPackages, shadow, utillinux }:
|
||||
|
||||
substituteAll {
|
||||
name = "nixos-container";
|
||||
dir = "bin";
|
||||
isExecutable = true;
|
||||
src = ./nixos-container.pl;
|
||||
perl = "${perl}/bin/perl -I${perlPackages.FileSlurp}/lib/perl5/site_perl";
|
||||
su = "${shadow.su}/bin/su";
|
||||
inherit utillinux;
|
||||
|
||||
postInstall = ''
|
||||
t=$out/etc/bash_completion.d
|
||||
mkdir -p $t
|
||||
cp ${./nixos-container-completion.sh} $t/nixos-container
|
||||
'';
|
||||
}
|
|
@ -16979,6 +16979,8 @@ in
|
|||
|
||||
nixos-artwork = callPackage ../data/misc/nixos-artwork { };
|
||||
|
||||
nixos-container = callPackage ../tools/virtualization/nixos-container { };
|
||||
|
||||
norwester-font = callPackage ../data/fonts/norwester {};
|
||||
|
||||
nut = callPackage ../applications/misc/nut { };
|
||||
|
|
Loading…
Reference in a new issue