diff options
Diffstat (limited to 'nixos/lib/utils.nix')
-rw-r--r-- | nixos/lib/utils.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix new file mode 100644 index 000000000000..35c56e8c32bb --- /dev/null +++ b/nixos/lib/utils.nix @@ -0,0 +1,10 @@ +pkgs: with pkgs.lib; + +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); + +} |