git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/containers: add extraFlags option

to pass extra flags to systemd-nspawn

commita82aae30846c9531058a767fd8cab90fd59fafe7 authorxeji <xeji@cat3.de> dateSun 25 Feb 2018, 14:22 (9 years ago) parent65e6a50
1 file changed+13−1
nixos/modules/virtualisation/containers.nix+13−1
nixos/modules/virtualisation/containers.nix+13−1
@@ -575,6 +575,16 @@ in
575575 '';
576576 };
577577
578+ extraFlags = mkOption {
579+ type = types.listOf types.str;
580+ default = [];
581+ example = [ "--drop-capability=CAP_SYS_CHROOT" ];
582+ description = ''
583+ Extra flags passed to the systemd-nspawn command.
584+ See systemd-nspawn(1) for details.
585+ '';
586+ };
587+
578588 } // networkOptions;
579589
580590 config = mkMerge
@@ -714,7 +724,9 @@ in
714724 ${optionalString cfg.autoStart ''
715725 AUTO_START=1
716726 ''}
717− EXTRA_NSPAWN_FLAGS="${mkBindFlags cfg.bindMounts}"
727+ EXTRA_NSPAWN_FLAGS="${mkBindFlags cfg.bindMounts +
728+ optionalString (cfg.extraFlags != [])
729+ (" " + concatStringsSep " " cfg.extraFlags)}"
718730 '';
719731 }) config.containers;
720732