0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

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

Fixes for NixOps issue #350
This commit is contained in:
zimbatm 2016-02-26 00:33:49 +00:00
commit b73c5ae291
2 changed files with 9 additions and 7 deletions

View file

@ -367,6 +367,8 @@ in
// { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; }
// config.networking.proxy.envVars;
unitConfig.RequiresMountsFor = "/nix/store";
serviceConfig =
{ Nice = cfg.daemonNiceLevel;
IOSchedulingPriority = cfg.daemonIONiceLevel;

View file

@ -261,12 +261,12 @@ while (my ($unit, $state) = each %{$activePrev}) {
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;
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 {
@ -290,7 +290,7 @@ my ($newFss, $newSwaps) = parseFstab "$out/etc/fstab";
foreach my $mountPoint (keys %$prevFss) {
my $prev = $prevFss->{$mountPoint};
my $new = $newFss->{$mountPoint};
my $unit = pathToUnitName($mountPoint) . ".mount";
my $unit = pathToUnitName($mountPoint);
if (!defined $new) {
# Filesystem entry disappeared, so unmount it.
$unitsToStop{$unit} = 1;