@@ -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