at 15.09-beta 281 B view raw
1pkgs: with pkgs.lib; 2 3rec { 4 5 # Escape a path according to the systemd rules, e.g. /dev/xyzzy 6 # becomes dev-xyzzy. FIXME: slow. 7 escapeSystemdPath = s: 8 replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"] 9 (if hasPrefix "/" s then substring 1 (stringLength s) s else s); 10 11}