diff options
Diffstat (limited to 'nixos/lib/utils.nix')
-rw-r--r-- | nixos/lib/utils.nix | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index 35c56e8c32b..7b8be2050c1 100644 --- a/nixos/lib/utils.nix +++ b/nixos/lib/utils.nix @@ -5,6 +5,7 @@ rec { # Escape a path according to the systemd rules, e.g. /dev/xyzzy # becomes dev-xyzzy. FIXME: slow. escapeSystemdPath = s: - replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"] (substring 1 (stringLength s) s); + replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"] + (if hasPrefix "/" s then substring 1 (stringLength s) s else s); } |