jail.nix/lib/helpers.nix
2025-09-28 15:58:58 -07:00

18 lines
431 B
Nix

pkgs: rec {
dataDir = "~/.local/share/jail.nix";
dataDirSubPath = subPath: "${dataDir}/${escape subPath}";
noescape = value: { _noescape = value; };
escape =
rawOrStr:
if builtins.typeOf rawOrStr == "set" && rawOrStr ? _noescape then
rawOrStr._noescape
else
pkgs.lib.strings.escapeShellArg rawOrStr;
pushState =
key: toPush: state:
state // { ${key} = state.${key} ++ [ toPush ]; };
}