jail.nix/lib/combinators/escape.nix
Alex David 6181276ae1 Split combinators into files
The `lib/combinators.nix` file was getting quite long and some ideas I
have for future combinators may even require ancillary files. To help
scale these changes, this commit breaks each combinator into its own
file under the `lib/combinators` directory.
2025-10-10 16:28:43 -07:00

25 lines
702 B
Nix

{ helpers, ... }:
{
sig = "String -> String";
doc = ''
Shell escapes the passed string.
Use [noescape](#noescape) to prevent escaping.
`escape` and `noescape` don't return `Permission`s, but they are useful
helpers to expose when defining jails and writing custom combinators, so
they are exposed with the rest of the combinators for convenience.
Example:
```nix
jail-nix.lib.extend {
inherit pkgs;
additionalCombinators = combinators: with combinators; {
# a combinator that binds the passed path to /foo
my-combinator = path: unsafe-add-raw-args "--bind ''${escape path} /foo"
};
}
```
'';
impl = helpers.escape;
}