mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 21:32:23 +03:00
switch-to-configuration: fix detection of changes between rebuilds for template instances
This makes declarative containers truly reloadable. Current code already declares it:56904d7c42/nixos/modules/virtualisation/containers.nix (L488)
``` restartIfChanged = false; ```56904d7c42/nixos/modules/virtualisation/containers.nix (L540)
``` reloadIfChanged = true; ``` Original author: @chrisfarms in6e36619b27
Most of stuff from that commit has already been ported.
This commit is contained in:
parent
37c340728e
commit
65ff0d5f9d
@ -147,11 +147,16 @@ my $activePrev = getActiveUnits;
|
||||
while (my ($unit, $state) = each %{$activePrev}) {
|
||||
my $baseUnit = $unit;
|
||||
|
||||
# Recognise template instances.
|
||||
$baseUnit = "$1\@.$2" if $unit =~ /^(.*)@[^\.]*\.(.*)$/;
|
||||
my $prevUnitFile = "/etc/systemd/system/$baseUnit";
|
||||
my $newUnitFile = "$out/etc/systemd/system/$baseUnit";
|
||||
|
||||
# Detect template instances.
|
||||
if (!-e $prevUnitFile && !-e $newUnitFile && $unit =~ /^(.*)@[^\.]*\.(.*)$/) {
|
||||
$baseUnit = "$1\@.$2";
|
||||
$prevUnitFile = "/etc/systemd/system/$baseUnit";
|
||||
$newUnitFile = "$out/etc/systemd/system/$baseUnit";
|
||||
}
|
||||
|
||||
my $baseName = $baseUnit;
|
||||
$baseName =~ s/\.[a-z]*$//;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user