diff options
author | Shea Levy <shea@shealevy.com> | 2016-01-12 10:05:52 -0500 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2016-01-12 10:05:52 -0500 |
commit | dbe94f2ec3eda65426ab527860d05f91c2fdd111 (patch) | |
tree | ee68eb97a5dbf431e3fa276a1e8883d33c06d4ec /nixos | |
parent | d5c070283b4add1a38822177be9f39cf94082aa7 (diff) | |
parent | 9df07753cef9dcc7f8aa08b3152bc62d95d01062 (diff) | |
download | nixpkgs-dbe94f2ec3eda65426ab527860d05f91c2fdd111.tar nixpkgs-dbe94f2ec3eda65426ab527860d05f91c2fdd111.tar.gz nixpkgs-dbe94f2ec3eda65426ab527860d05f91c2fdd111.tar.bz2 nixpkgs-dbe94f2ec3eda65426ab527860d05f91c2fdd111.tar.lz nixpkgs-dbe94f2ec3eda65426ab527860d05f91c2fdd111.tar.xz nixpkgs-dbe94f2ec3eda65426ab527860d05f91c2fdd111.tar.zst nixpkgs-dbe94f2ec3eda65426ab527860d05f91c2fdd111.zip |
Merge branch 'swap-norestart' of git://github.com/abbradar/nixpkgs
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/config/swap.nix | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix index 0ab5bb3d89c..f0353c5a35e 100644 --- a/nixos/modules/config/swap.nix +++ b/nixos/modules/config/swap.nix @@ -128,6 +128,7 @@ in wantedBy = [ "${realDevice'}.swap" ]; before = [ "${realDevice'}.swap" ]; path = [ pkgs.utillinux ] ++ optional sw.randomEncryption pkgs.cryptsetup; + script = '' ${optionalString (sw.size != null) '' @@ -145,11 +146,13 @@ in mkswap ${sw.realDevice} ''} ''; + unitConfig.RequiresMountsFor = [ "${dirOf sw.device}" ]; unitConfig.DefaultDependencies = false; # needed to prevent a cycle serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = sw.randomEncryption; serviceConfig.ExecStop = optionalString sw.randomEncryption "${pkgs.cryptsetup}/bin/cryptsetup luksClose ${sw.deviceName}"; + restartIfChanged = false; }; in listToAttrs (map createSwapDevice (filter (sw: sw.size != null || sw.randomEncryption) config.swapDevices)); |