aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/run-firecracker-vm
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/run-firecracker-vm')
-rw-r--r--pkgs/run-firecracker-vm/default.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/run-firecracker-vm/default.nix b/pkgs/run-firecracker-vm/default.nix
index b9a2984..dbdf2b6 100644
--- a/pkgs/run-firecracker-vm/default.nix
+++ b/pkgs/run-firecracker-vm/default.nix
@@ -319,14 +319,20 @@ let
layerNames = [ null ] ++ map layerName layers; # the base system: none
# Layer k's image: the store paths of its system's closure that aren't
- # in the closures of the layers below, as erofs image.
+ # in the closures of the layers below, as erofs image. Without any of
+ # the systems' initrds, which Firecracker gets from the host, and which
+ # the guest never reads (for nix, the host's store still has them).
+ initrds = map (s: "${s.config.system.build.initialRamdisk}") systems;
images = lib.imap0 (k: top: let name = lib.elemAt layerNames k; in pkgs.runCommand
"firecracker-layer-${toString k}${lib.optionalString (name != null) "-${lib.strings.sanitizeDerivationName name}"}.img" {
nativeBuildInputs = [ pkgs.erofs-utils pkgs.gnutar ];
closure = pkgs.closureInfo { rootPaths = [ top ]; };
below = map (t: pkgs.closureInfo { rootPaths = [ t ]; }) (lib.take k toplevels);
+ inherit initrds;
} ''
- for b in $below; do cat $b/store-paths; done | sort -u > below
+ for b in $below; do cat $b/store-paths; done > below
+ printf '%s\n' $initrds >> below
+ sort -u -o below below
sort $closure/store-paths | comm -23 - below |
tar -c -P --verbatim-files-from \
--transform 'flags=rSh;s|^/nix/store/||' \