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.
This commit is contained in:
parent
8fa6d132e1
commit
6181276ae1
54 changed files with 1531 additions and 1260 deletions
25
lib/combinators/escape.nix
Normal file
25
lib/combinators/escape.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue