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
37
lib/combinators/network.nix
Normal file
37
lib/combinators/network.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ combinators, ... }:
|
||||
let
|
||||
inherit (combinators)
|
||||
compose
|
||||
escape
|
||||
include-once
|
||||
runtime-deep-ro-bind
|
||||
share-ns
|
||||
time-zone
|
||||
unsafe-add-raw-args
|
||||
write-text
|
||||
;
|
||||
in
|
||||
{
|
||||
sig = "Permission";
|
||||
doc = ''
|
||||
Grants network access to the jail.
|
||||
|
||||
This also exposes everything required to allow TLS connections.
|
||||
|
||||
You can set your desired hostname with [set-hostname](#set-hostname). The
|
||||
default is `jail`.
|
||||
'';
|
||||
impl = include-once "network" (
|
||||
state:
|
||||
compose [
|
||||
time-zone
|
||||
(share-ns "net")
|
||||
(runtime-deep-ro-bind "/etc/hosts")
|
||||
(runtime-deep-ro-bind "/etc/nsswitch.conf")
|
||||
(runtime-deep-ro-bind "/etc/resolv.conf")
|
||||
(runtime-deep-ro-bind "/etc/ssl")
|
||||
(write-text "/etc/hostname" "${state.hostname}\n")
|
||||
(unsafe-add-raw-args "--hostname ${escape state.hostname}")
|
||||
] state
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue