From 2de0cf2549e79427fd23f0ce2f2b0021247ba07e Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 3 Sep 2014 18:40:05 -0700 Subject: [PATCH] nixos/utils: Don't remove first character if not a / --- nixos/lib/utils.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); }