lol

swap service: don't restart mkswap.service on switches

Sadly, we can't instruct systemd to properly restart device-name.swap when this service restarts (or I haven't found the way to do so). As of now blindly restarting it would only get you a bunch of errors about device already used -- let's avoid it.

+3
+3
nixos/modules/config/swap.nix
··· 128 128 wantedBy = [ "${realDevice'}.swap" ]; 129 129 before = [ "${realDevice'}.swap" ]; 130 130 path = [ pkgs.utillinux ] ++ optional sw.randomEncryption pkgs.cryptsetup; 131 + 131 132 script = 132 133 '' 133 134 ${optionalString (sw.size != null) '' ··· 145 146 mkswap ${sw.realDevice} 146 147 ''} 147 148 ''; 149 + 148 150 unitConfig.RequiresMountsFor = [ "${dirOf sw.device}" ]; 149 151 unitConfig.DefaultDependencies = false; # needed to prevent a cycle 150 152 serviceConfig.Type = "oneshot"; 151 153 serviceConfig.RemainAfterExit = sw.randomEncryption; 152 154 serviceConfig.ExecStop = optionalString sw.randomEncryption "${pkgs.cryptsetup}/bin/cryptsetup luksClose ${sw.deviceName}"; 155 + restartIfChanged = false; 153 156 }; 154 157 155 158 in listToAttrs (map createSwapDevice (filter (sw: sw.size != null || sw.randomEncryption) config.swapDevices));