nixos-containers: bindMounts: change default to readOnly. use EXTRA_NSPAWN_FLAGS
This commit is contained in:
parent
4d551227c9
commit
ae2279bcdb
|
@ -47,7 +47,7 @@ let
|
||||||
mountPoint = mkOption {
|
mountPoint = mkOption {
|
||||||
example = "/mnt/usb";
|
example = "/mnt/usb";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "Location of the mounted in the container file systems";
|
description = "Mount point on the container file system";
|
||||||
};
|
};
|
||||||
hostPath = mkOption {
|
hostPath = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -56,7 +56,7 @@ let
|
||||||
description = "Location of the host path to be mounted";
|
description = "Location of the host path to be mounted";
|
||||||
};
|
};
|
||||||
isReadOnly = mkOption {
|
isReadOnly = mkOption {
|
||||||
default = false;
|
default = true;
|
||||||
example = true;
|
example = true;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Determine whether the mounted path will be accessed in read-only mode";
|
description = "Determine whether the mounted path will be accessed in read-only mode";
|
||||||
|
@ -288,7 +288,7 @@ in
|
||||||
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 \
|
$EXTRA_NSPAWN_FLAGS \
|
||||||
--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 \
|
||||||
|
@ -384,12 +384,10 @@ in
|
||||||
LOCAL_ADDRESS=${cfg.localAddress}
|
LOCAL_ADDRESS=${cfg.localAddress}
|
||||||
''}
|
''}
|
||||||
''}
|
''}
|
||||||
${optionalString cfg.autoStart ''
|
${optionalString cfg.autoStart ''
|
||||||
AUTO_START=1
|
AUTO_START=1
|
||||||
''}
|
''}
|
||||||
|
EXTRA_NSPAWN_FLAGS="${mkBindFlags cfg.bindMounts}"
|
||||||
EXTRABINDS="${mkBindFlags cfg.bindMounts}"
|
|
||||||
|
|
||||||
'';
|
'';
|
||||||
}) config.containers;
|
}) config.containers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue