Merge pull request #35541 from xeji/containers-extraflags

nixos/containers: add extraFlags option
This commit is contained in:
Jörg Thalheim 2018-04-21 14:16:49 +01:00 committed by GitHub
commit 862f5b0b34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -575,6 +575,16 @@ in
'';
};
extraFlags = mkOption {
type = types.listOf types.str;
default = [];
example = [ "--drop-capability=CAP_SYS_CHROOT" ];
description = ''
Extra flags passed to the systemd-nspawn command.
See systemd-nspawn(1) for details.
'';
};
} // networkOptions;
config = mkMerge
@ -714,7 +724,9 @@ in
${optionalString cfg.autoStart ''
AUTO_START=1
''}
EXTRA_NSPAWN_FLAGS="${mkBindFlags cfg.bindMounts}"
EXTRA_NSPAWN_FLAGS="${mkBindFlags cfg.bindMounts +
optionalString (cfg.extraFlags != [])
(" " + concatStringsSep " " cfg.extraFlags)}"
'';
}) config.containers;