summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-10-13 12:01:05 +0000
committerGitHub <noreply@github.com>2023-10-13 12:01:05 +0000
commit4645621691917cee2456cfc045a815c48c8c78c2 (patch)
treed58ef6b00757450b1c632c3852a483023c416fc7 /nixos/modules
parent58fdb93d6f5fd794406ea5152a8641e7247b8242 (diff)
parent41f3887abd90b9c5fda4b350be264a731cd8eda4 (diff)
downloadnixpkgs-4645621691917cee2456cfc045a815c48c8c78c2.tar
nixpkgs-4645621691917cee2456cfc045a815c48c8c78c2.tar.gz
nixpkgs-4645621691917cee2456cfc045a815c48c8c78c2.tar.bz2
nixpkgs-4645621691917cee2456cfc045a815c48c8c78c2.tar.lz
nixpkgs-4645621691917cee2456cfc045a815c48c8c78c2.tar.xz
nixpkgs-4645621691917cee2456cfc045a815c48c8c78c2.tar.zst
nixpkgs-4645621691917cee2456cfc045a815c48c8c78c2.zip
Merge master into staging-next
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/virtualisation/lxc-container.nix21
1 files changed, 12 insertions, 9 deletions
diff --git a/nixos/modules/virtualisation/lxc-container.nix b/nixos/modules/virtualisation/lxc-container.nix
index 9402d3bf37d..c40c7bee188 100644
--- a/nixos/modules/virtualisation/lxc-container.nix
+++ b/nixos/modules/virtualisation/lxc-container.nix
@@ -9,15 +9,16 @@ in {
 
   options = {
     virtualisation.lxc = {
-      privilegedContainer = lib.mkOption {
-        type = lib.types.bool;
-        default = false;
-        description = lib.mdDoc ''
-          Whether this LXC container will be running as a privileged container or not. If set to `true` then
-          additional configuration will be applied to the `systemd` instance running within the container as
-          recommended by [distrobuilder](https://linuxcontainers.org/distrobuilder/introduction/).
-        '';
-      };
+      nestedContainer = lib.mkEnableOption (lib.mdDoc ''
+        Whether this container is configured as a nested container. On LXD containers this is recommended
+        for all containers and is enabled with `security.nesting = true`.
+      '');
+
+      privilegedContainer = lib.mkEnableOption (lib.mdDoc ''
+        Whether this LXC container will be running as a privileged container or not. If set to `true` then
+        additional configuration will be applied to the `systemd` instance running within the container as
+        recommended by [distrobuilder](https://linuxcontainers.org/distrobuilder/introduction/).
+      '');
     };
   };
 
@@ -68,6 +69,8 @@ in {
       ln -fs "$1/init" /sbin/init
     '';
 
+    systemd.additionalUpstreamSystemUnits = lib.mkIf cfg.nestedContainer ["systemd-udev-trigger.service"];
+
     # Add the overrides from lxd distrobuilder
     # https://github.com/lxc/distrobuilder/blob/05978d0d5a72718154f1525c7d043e090ba7c3e0/distrobuilder/main.go#L630
     systemd.packages = [