summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-04-21 14:16:49 +0100
committerGitHub <noreply@github.com>2018-04-21 14:16:49 +0100
commit862f5b0b34bd2af8176a2755d26aecaf7e475f63 (patch)
tree978ac1d349de8277200ac12d9ff0680b2315c56d /nixos/modules/virtualisation
parent9a3583de4054dcde3fd1a1598c51faf1e8e2ee4b (diff)
parenta82aae30846c9531058a767fd8cab90fd59fafe7 (diff)
downloadnixpkgs-862f5b0b34bd2af8176a2755d26aecaf7e475f63.tar
nixpkgs-862f5b0b34bd2af8176a2755d26aecaf7e475f63.tar.gz
nixpkgs-862f5b0b34bd2af8176a2755d26aecaf7e475f63.tar.bz2
nixpkgs-862f5b0b34bd2af8176a2755d26aecaf7e475f63.tar.lz
nixpkgs-862f5b0b34bd2af8176a2755d26aecaf7e475f63.tar.xz
nixpkgs-862f5b0b34bd2af8176a2755d26aecaf7e475f63.tar.zst
nixpkgs-862f5b0b34bd2af8176a2755d26aecaf7e475f63.zip
Merge pull request #35541 from xeji/containers-extraflags
nixos/containers: add extraFlags option
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/containers.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index 7ec443248de..248c2fc1fb2 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -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;