summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/modules/virtualisation/lxc-container.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/lxc-container.nix b/nixos/modules/virtualisation/lxc-container.nix
index e47bd59dc01..a6f82e4436f 100644
--- a/nixos/modules/virtualisation/lxc-container.nix
+++ b/nixos/modules/virtualisation/lxc-container.nix
@@ -7,6 +7,34 @@ with lib;
     ../profiles/docker-container.nix # FIXME, shouldn't include something from profiles/
   ];
 
+  system.build.tarball = mkForce (pkgs.callPackage ../../lib/make-system-tarball.nix {
+    extraArgs = "--owner=0";
+
+    storeContents = [
+      config.system.build.toplevel
+    ];
+
+    contents = [
+      {
+        source = pkgs.writeText "metadata.yaml" ''
+          architecture: ${builtins.elemAt (builtins.match "^([a-z0-9_]+).+" (toString pkgs.system)) 0}
+          creation_date: 0
+          properties:
+            description: NixOS ${config.system.nixos.codeName} ${config.system.nixos.label} ${pkgs.system}
+            os: nixos
+            release: ${config.system.nixos.codeName}
+        '';
+        target = "/metadata.yaml";
+      }
+      {
+        source = config.system.build.toplevel + "/init";
+        target = "/sbin/init";
+      }
+    ];
+
+    extraCommands = "mkdir -p proc sys dev";
+  });
+
   # Allow the user to login as root without password.
   users.users.root.initialHashedPassword = mkOverride 150 "";