jail.nix/lib/helpers.nix

18 lines
431 B
Nix
Raw Permalink Normal View History

2025-08-07 15:29:16 -07:00
pkgs: rec {
dataDir = "~/.local/share/jail.nix";
dataDirSubPath = subPath: "${dataDir}/${escape subPath}";
noescape = value: { _noescape = value; };
2025-09-11 07:31:48 -07:00
escape =
rawOrStr:
if builtins.typeOf rawOrStr == "set" && rawOrStr ? _noescape then
rawOrStr._noescape
else
pkgs.lib.strings.escapeShellArg rawOrStr;
2025-09-28 15:58:58 -07:00
pushState =
key: toPush: state:
state // { ${key} = state.${key} ++ [ toPush ]; };
2025-08-07 15:29:16 -07:00
}