summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-08-31 17:59:45 +0400
committerGitHub <noreply@github.com>2016-08-31 17:59:45 +0400
commita4879c44c90f9cbd4c2ffbad9f544ce028ff2c83 (patch)
tree38f7c828675b259499acb6d2b56193a08954a9ef /nixos
parent7fa8c424bd1b1192d4a5653074f7c8ae271cfa68 (diff)
parenta7d238136d9d2cbc88026d981c2e0f515fcf0229 (diff)
downloadnixpkgs-a4879c44c90f9cbd4c2ffbad9f544ce028ff2c83.tar
nixpkgs-a4879c44c90f9cbd4c2ffbad9f544ce028ff2c83.tar.gz
nixpkgs-a4879c44c90f9cbd4c2ffbad9f544ce028ff2c83.tar.bz2
nixpkgs-a4879c44c90f9cbd4c2ffbad9f544ce028ff2c83.tar.lz
nixpkgs-a4879c44c90f9cbd4c2ffbad9f544ce028ff2c83.tar.xz
nixpkgs-a4879c44c90f9cbd4c2ffbad9f544ce028ff2c83.tar.zst
nixpkgs-a4879c44c90f9cbd4c2ffbad9f544ce028ff2c83.zip
Merge pull request #18160 from obadz/swap-encryption
nixos/…/swap.nix: remove backslashes from deviceName
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/swap.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index 62b6e011713..968bb22f354 100644
--- a/nixos/modules/config/swap.nix
+++ b/nixos/modules/config/swap.nix
@@ -54,6 +54,10 @@ let
           WARNING: Don't try to hibernate when you have at least one swap partition with
           this option enabled! We have no way to set the partition into which hibernation image
           is saved, so if your image ends up on an encrypted one you would lose it!
+
+          WARNING #2: Do not use /dev/disk/by-uuid/… or /dev/disk/by-label/… as your swap device
+          when using randomEncryption as the UUIDs and labels will get erased on every boot when
+          the partition is encrypted. Best to use /dev/disk/by-partuuid/…
         '';
       };
 
@@ -72,7 +76,7 @@ let
     config = rec {
       device = mkIf options.label.isDefined
         "/dev/disk/by-label/${config.label}";
-      deviceName = escapeSystemdPath config.device;
+      deviceName = lib.replaceChars ["\\"] [""] (escapeSystemdPath config.device);
       realDevice = if config.randomEncryption then "/dev/mapper/${deviceName}" else config.device;
     };