mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 13:15:30 +03:00
extraBindsRO/extraBindsRW
This commit is contained in:
parent
7b49289c74
commit
cac38c8664
1 changed files with 27 additions and 0 deletions
|
@ -127,6 +127,27 @@ in
|
||||||
Wether the container is automatically started at boot-time.
|
Wether the container is automatically started at boot-time.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraBindsRO = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = [ "/home/alice" ];
|
||||||
|
description =
|
||||||
|
''
|
||||||
|
An extra list of directories that is bound to the container with read-only permission.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraBindsRW = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = [ "/home/alice" ];
|
||||||
|
description =
|
||||||
|
''
|
||||||
|
An extra list of directories that is bound to the container with read-only permission.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkMerge
|
config = mkMerge
|
||||||
|
@ -230,12 +251,15 @@ in
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Run systemd-nspawn without startup notification (we'll
|
# Run systemd-nspawn without startup notification (we'll
|
||||||
# wait for the container systemd to signal readiness).
|
# wait for the container systemd to signal readiness).
|
||||||
EXIT_ON_REBOOT=1 NOTIFY_SOCKET= \
|
EXIT_ON_REBOOT=1 NOTIFY_SOCKET= \
|
||||||
exec ${config.systemd.package}/bin/systemd-nspawn \
|
exec ${config.systemd.package}/bin/systemd-nspawn \
|
||||||
--keep-unit \
|
--keep-unit \
|
||||||
-M "$INSTANCE" -D "$root" $extraFlags \
|
-M "$INSTANCE" -D "$root" $extraFlags \
|
||||||
|
$EXTRABINDS \
|
||||||
--bind-ro=/nix/store \
|
--bind-ro=/nix/store \
|
||||||
--bind-ro=/nix/var/nix/db \
|
--bind-ro=/nix/var/nix/db \
|
||||||
--bind-ro=/nix/var/nix/daemon-socket \
|
--bind-ro=/nix/var/nix/daemon-socket \
|
||||||
|
@ -334,6 +358,9 @@ in
|
||||||
${optionalString cfg.autoStart ''
|
${optionalString cfg.autoStart ''
|
||||||
AUTO_START=1
|
AUTO_START=1
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
EXTRABINDS="${concatMapStrings (d: " --bind-ro=${d}") cfg.extraBindsRO + concatMapStrings (d: " --bind=${d}") cfg.extraBindsRW}"
|
||||||
|
|
||||||
'';
|
'';
|
||||||
}) config.containers;
|
}) config.containers;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue