diff options
author | William A. Kennington III <william@wkennington.com> | 2014-09-03 18:40:05 -0700 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2014-09-03 18:40:05 -0700 |
commit | 2de0cf2549e79427fd23f0ce2f2b0021247ba07e (patch) | |
tree | 7ac5ccbc014e398a93ae5b24b27ff52aed07733d /nixos/lib/utils.nix | |
parent | 0c398f60405090743fbdcf14faf1193c642b6328 (diff) | |
download | nixpkgs-2de0cf2549e79427fd23f0ce2f2b0021247ba07e.tar nixpkgs-2de0cf2549e79427fd23f0ce2f2b0021247ba07e.tar.gz nixpkgs-2de0cf2549e79427fd23f0ce2f2b0021247ba07e.tar.bz2 nixpkgs-2de0cf2549e79427fd23f0ce2f2b0021247ba07e.tar.lz nixpkgs-2de0cf2549e79427fd23f0ce2f2b0021247ba07e.tar.xz nixpkgs-2de0cf2549e79427fd23f0ce2f2b0021247ba07e.tar.zst nixpkgs-2de0cf2549e79427fd23f0ce2f2b0021247ba07e.zip |
nixos/utils: Don't remove first character if not a /
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); } |