
$ nix-build -A examples.dummy.config.debug.closure.erofs.list | xargs cat | xargs du -h 749M /nix/store/bzfv5x6lycq6hzhjv6d6vlk1q8fdg9di-base0.erofs 24M /nix/store/hp41jfq36y0mmjrzqilyh3jfsvqic3kb-nixos.erofs $ nix run -f . examples.dummy.config.uvms.cloud-hypervisor.runner ... <<< Welcome to NixOS 25.11pre-git (x86_64) - ttyS0 >>> nixos login: The definition of the `pkgs` fixpoint was moved to pkgs/default.nix. For that, dirToAttrs was moved to lib/, imported ad hoc
35 lines
708 B
Nix
35 lines
708 B
Nix
{ lib, writeErofs }:
|
|
{
|
|
layers,
|
|
labelLower ? "base",
|
|
labelUpper ? "image",
|
|
}:
|
|
|
|
let
|
|
inherit (lib.lists) toList;
|
|
nLayers = builtins.length layers;
|
|
mkLabel = seq: if seq + 1 < nLayers then labelLower + toString seq else labelUpper;
|
|
f =
|
|
{
|
|
roots ? [ ],
|
|
layers ? [ ],
|
|
seq ? 0,
|
|
}:
|
|
newRoots: {
|
|
seq = seq + 1;
|
|
roots = roots ++ (toList newRoots);
|
|
layers = layers ++ [
|
|
(writeErofs ({
|
|
roots = toList newRoots;
|
|
rootsExclude = roots;
|
|
passthru = {
|
|
inherit seq;
|
|
label = mkLabel seq;
|
|
};
|
|
label = mkLabel seq;
|
|
}))
|
|
];
|
|
};
|
|
acc = lib.foldl f { } layers;
|
|
in
|
|
acc.layers
|