diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-09-20 18:37:17 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-02-05 23:15:18 +0100 |
commit | fb051f0dece79d2ac28ad368d6e26289d780bc0a (patch) | |
tree | dfb93e77a3e052eec3f601855dbdedbfa780cf2c /pkgs/tools/virtualization/nixos-container | |
parent | 20087bd5534e115a1c7ddd5279610bc437c39046 (diff) |
nixos-{rebuild,container}: Use flakeref#attrpath syntax
This makes them consistent with the 'nix' command line.
Diffstat (limited to 'pkgs/tools/virtualization/nixos-container')
-rwxr-xr-x | pkgs/tools/virtualization/nixos-container/nixos-container.pl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/tools/virtualization/nixos-container/nixos-container.pl b/pkgs/tools/virtualization/nixos-container/nixos-container.pl index 392d59486c13..727c0333b275 100755 --- a/pkgs/tools/virtualization/nixos-container/nixos-container.pl +++ b/pkgs/tools/virtualization/nixos-container/nixos-container.pl @@ -64,6 +64,7 @@ my $configFile; my $hostAddress; my $localAddress; my $flake; +my $flakeAttr = "container"; GetOptions( "help" => sub { showHelp() }, @@ -92,6 +93,11 @@ if (defined $configFile and defined $extraConfig) { "Please define on or the other, but not both"; } +if (defined $flake && $flake =~ /^(.*)#([^#"]+)$/) { + $flake = $1; + $flakeAttr = $2; +} + # Execute the selected action. mkpath("/etc/containers", 0, 0755); @@ -137,7 +143,7 @@ EOF sub buildFlake { system("nix", "build", "-o", "$systemPath.tmp", "--", - "$flake:nixosConfigurations.container.config.system.build.toplevel") == 0 + "$flake#nixosConfigurations.\"$flakeAttr\".config.system.build.toplevel") == 0 or die "$0: failed to build container from flake '$flake'\n"; $systemPath = readlink("$systemPath.tmp") or die; unlink("$systemPath.tmp"); |