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

Fixes for NixOps issue #350

+9 -7
+2
nixos/modules/services/misc/nix-daemon.nix
··· 367 367 // { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; } 368 368 // config.networking.proxy.envVars; 369 369 370 + unitConfig.RequiresMountsFor = "/nix/store"; 371 + 370 372 serviceConfig = 371 373 { Nice = cfg.daemonNiceLevel; 372 374 IOSchedulingPriority = cfg.daemonIONiceLevel;
+7 -7
nixos/modules/system/activation/switch-to-configuration.pl
··· 261 261 262 262 sub pathToUnitName { 263 263 my ($path) = @_; 264 - die unless substr($path, 0, 1) eq "/"; 265 - return "-" if $path eq "/"; 266 - $path = substr($path, 1); 267 - $path =~ s/\//-/g; 268 - # FIXME: handle - and unprintable characters. 269 - return $path; 264 + open my $cmd, "-|", "systemd-escape", "--suffix=mount", "-p", $path 265 + or die "Unable to escape $path!\n"; 266 + my $escaped = join "", <$cmd>; 267 + chomp $escaped; 268 + close $cmd or die; 269 + return $escaped; 270 270 } 271 271 272 272 sub unique { ··· 290 290 foreach my $mountPoint (keys %$prevFss) { 291 291 my $prev = $prevFss->{$mountPoint}; 292 292 my $new = $newFss->{$mountPoint}; 293 - my $unit = pathToUnitName($mountPoint) . ".mount"; 293 + my $unit = pathToUnitName($mountPoint); 294 294 if (!defined $new) { 295 295 # Filesystem entry disappeared, so unmount it. 296 296 $unitsToStop{$unit} = 1;