kubernetes-deployments/utils.nix

41 lines
818 B
Nix
Raw Normal View History

2024-10-28 15:05:06 +00:00
{
2024-12-19 19:34:55 +00:00
self,
2024-10-28 15:05:06 +00:00
pkgs,
nixpkgs,
nixng,
globals,
2024-12-19 19:34:55 +00:00
nix-snapshotter,
2024-10-28 15:05:06 +00:00
...
}: {
mkNixNGImage = name: file: let
stream =
(import file {
inherit nixpkgs nixng globals;
inherit (nixng) nglib;
2024-10-28 15:05:06 +00:00
})
.config
.system
.build
.ociImage
.stream;
in
pkgs.stdenv.mkDerivation {
name = "${name}.tar";
src = stream;
dontUnpack = true;
buildPhase = ''
$src > $out
'';
};
nixSnapshotterRef = imagePath: "nix:0${imagePath}";
2024-12-19 19:34:55 +00:00
mkNixNGImage2 = name:
(nix-snapshotter.packages.${pkgs.stdenv.system}.nix-snapshotter.buildImage {
inherit name;
resolvedByNix = true;
config.entrypoint = ["${self.nixngConfigurations.${pkgs.stdenv.system}.${name}.config.system.build.toplevel}/init"];
})
.image;
}