nixos/nixos-container: use custom path if specified by --nixos-path

This commit is contained in:
Maximilian Bosch 2020-02-10 15:12:00 +01:00
parent 93943acbc5
commit 31bbcc21d3
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E

View File

@ -43,6 +43,7 @@ Usage: nixos-container list
[--config <string>]
[--config-file <path>]
[--flake <flakeref>]
[--nixos-path <path>]
nixos-container login <container-name>
nixos-container root-login <container-name>
nixos-container run <container-name> -- args...
@ -386,6 +387,7 @@ elsif ($action eq "update") {
system("nix-env", "-p", "$profileDir/system", "--set", $systemPath) == 0
or die "$0: failed to set container configuration\n";
} else {
my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
# FIXME: may want to be more careful about clobbering the existing
@ -395,8 +397,9 @@ elsif ($action eq "update") {
writeNixOSConfig $nixosConfigFile;
}
my $nixenvF = $nixosPath // "<nixpkgs/nixos>";
system("nix-env", "-p", "$profileDir/system",
"-I", "nixos-config=$nixosConfigFile", "-f", "<nixpkgs/nixos>",
"-I", "nixos-config=$nixosConfigFile", "-f", $nixenvF,
"--set", "-A", "system") == 0
or die "$0: failed to build container configuration\n";
}