diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2020-02-10 15:12:00 +0100 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2020-02-11 14:44:38 +0100 |
commit | 31bbcc21d38366489120341bb74438cd38f4bf40 (patch) | |
tree | dbe85346a8c3f1e91de9569ab5851c86cd7a370e /pkgs/tools/virtualization/nixos-container | |
parent | 93943acbc5d795a34a0f933d3b31094fc2c7b78f (diff) |
nixos/nixos-container: use custom path if specified by `--nixos-path`
Diffstat (limited to 'pkgs/tools/virtualization/nixos-container')
-rwxr-xr-x | pkgs/tools/virtualization/nixos-container/nixos-container.pl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/tools/virtualization/nixos-container/nixos-container.pl b/pkgs/tools/virtualization/nixos-container/nixos-container.pl index a14926a9767b..df4c8fee21b4 100755 --- a/pkgs/tools/virtualization/nixos-container/nixos-container.pl +++ b/pkgs/tools/virtualization/nixos-container/nixos-container.pl @@ -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"; } |