I have a few combinator ideas that I'd like to try adding but I still
haven't fully fleshed them out yet. In order to reduce breaking people's
setup, this introduces a new `experimental` flag on combinators that
separates them on the docs website to let users know that their design
may not be fully finalized yet.
To make it easier to rename combinators without breaking anyone's
configuration, this change allows combinators to specify a list of
`aliases` that are also exported from `jail.combinators`.
The aliases are also documented on the documentation website.
These have been deprecated for some time now, and were deprecated before
I gave my nixcon talk which brought attention to this library. So I
think it's pretty doubtful that anyone is still using these.
`base-permissions.nix` was the source of truth for all of the base
combinators, but it was not documented well anywhere.
To make this easier and more obvious for users, this commit pulls all
remaining custom permissions into a new `base` combinator which is
included by default. This way there is no more undocumented permissions
included by default, they are all documented in the `Default included
combinators` section of the docs.
This should also make it easier to override base permissions because
users can now just specify `base` instead of all of the
`unsafe-add-raw-args` calls unless they really want to change them.
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.
The term `combinator` was overloaded before, being used to refer both to
the functions that are exposed to help build a jail, and their return
value to be passed into `jail`/`basePermissions`. This commit renames
the latter to `Permission`.
Instead of requiring the third argument to be a function that passes in
combinators, this exposes all combinators on `jail.combinators` and
allows the third argument to just be a list (or even null!). This may be
more ergonomic in some contexts (like nixpkgs overlays).
This isn't a breaking change, the third argument can still be a function
and will receive the combinators if it is.
By using `__functor` combinators can call each other directly by using
`rec` rather than needing to mapAttrs over all of the combinators to
inject them into each one.