nixos-{rebuild,container}: Use flakeref#attrpath syntax
This makes them consistent with the 'nix' command line.
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user