mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
Merge pull request #312516 from Stunkymonkey/nixos-swap-umask
nixos/swap: prefer 'umask' over 'chmod'
This commit is contained in:
commit
ba5a6f19ed
@ -275,7 +275,6 @@ in
|
||||
chattr +C "$DEVICE" 2>/dev/null || true
|
||||
|
||||
dd if=/dev/zero of="$DEVICE" bs=1M count=${toString sw.size}
|
||||
chmod 0600 ${sw.device}
|
||||
${optionalString (!sw.randomEncryption.enable) "mkswap ${sw.realDevice}"}
|
||||
fi
|
||||
''}
|
||||
@ -292,9 +291,12 @@ in
|
||||
|
||||
unitConfig.RequiresMountsFor = [ "${dirOf sw.device}" ];
|
||||
unitConfig.DefaultDependencies = false; # needed to prevent a cycle
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.RemainAfterExit = sw.randomEncryption.enable;
|
||||
serviceConfig.ExecStop = optionalString sw.randomEncryption.enable "${pkgs.cryptsetup}/bin/cryptsetup luksClose ${sw.deviceName}";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = sw.randomEncryption.enable;
|
||||
UMask = "0177";
|
||||
ExecStop = optionalString sw.randomEncryption.enable "${pkgs.cryptsetup}/bin/cryptsetup luksClose ${sw.deviceName}";
|
||||
};
|
||||
restartIfChanged = false;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user