Merge pull request #10546 from aszlig/nixops-issue-350

Fixes for NixOps issue #350

zimbatm b73c5ae2 30891166

Changed files
+9 -7
nixos
modules
services
system
+2
nixos/modules/services/misc/nix-daemon.nix
···
// { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; }
// config.networking.proxy.envVars;
serviceConfig =
{ Nice = cfg.daemonNiceLevel;
IOSchedulingPriority = cfg.daemonIONiceLevel;
···
// { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; }
// config.networking.proxy.envVars;
+
unitConfig.RequiresMountsFor = "/nix/store";
+
serviceConfig =
{ Nice = cfg.daemonNiceLevel;
IOSchedulingPriority = cfg.daemonIONiceLevel;
+7 -7
nixos/modules/system/activation/switch-to-configuration.pl
···
sub pathToUnitName {
my ($path) = @_;
-
die unless substr($path, 0, 1) eq "/";
-
return "-" if $path eq "/";
-
$path = substr($path, 1);
-
$path =~ s/\//-/g;
-
# FIXME: handle - and unprintable characters.
-
return $path;
}
sub unique {
···
foreach my $mountPoint (keys %$prevFss) {
my $prev = $prevFss->{$mountPoint};
my $new = $newFss->{$mountPoint};
-
my $unit = pathToUnitName($mountPoint) . ".mount";
if (!defined $new) {
# Filesystem entry disappeared, so unmount it.
$unitsToStop{$unit} = 1;
···
sub pathToUnitName {
my ($path) = @_;
+
open my $cmd, "-|", "systemd-escape", "--suffix=mount", "-p", $path
+
or die "Unable to escape $path!\n";
+
my $escaped = join "", <$cmd>;
+
chomp $escaped;
+
close $cmd or die;
+
return $escaped;
}
sub unique {
···
foreach my $mountPoint (keys %$prevFss) {
my $prev = $prevFss->{$mountPoint};
my $new = $newFss->{$mountPoint};
+
my $unit = pathToUnitName($mountPoint);
if (!defined $new) {
# Filesystem entry disappeared, so unmount it.
$unitsToStop{$unit} = 1;