2012-10-12 23:01:49 +02:00
|
|
|
pkgs: with pkgs.lib;
|
|
|
|
|
|
|
|
rec {
|
|
|
|
|
|
|
|
# Escape a path according to the systemd rules, e.g. /dev/xyzzy
|
|
|
|
# becomes dev-xyzzy. FIXME: slow.
|
|
|
|
escapeSystemdPath = s:
|
2014-09-04 03:40:05 +02:00
|
|
|
replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"]
|
|
|
|
(if hasPrefix "/" s then substring 1 (stringLength s) s else s);
|
2012-10-12 23:01:49 +02:00
|
|
|
|
2016-06-12 21:03:14 +02:00
|
|
|
# Returns a system path for a given shell package
|
|
|
|
toShellPath = shell:
|
|
|
|
if types.shellPackage.check shell then
|
|
|
|
"/run/current-system/sw${shell.shellPath}"
|
|
|
|
else
|
|
|
|
shell;
|
2012-10-12 23:01:49 +02:00
|
|
|
}
|