summary refs log tree commit diff
path: root/lib/utils.nix
blob: 35c56e8c32bbf9b2990a56215201395874f7a078 (plain) (blame)
1
2
3
4
5
6
7
8
9
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);

}