kubernetes-deployments/utils.nix

40 lines
818 B
Nix

{
self,
pkgs,
nixpkgs,
nixng,
globals,
nix-snapshotter,
...
}: {
mkNixNGImage = name: file: let
stream =
(import file {
inherit nixpkgs nixng globals;
inherit (nixng) nglib;
})
.config
.system
.build
.ociImage
.stream;
in
pkgs.stdenv.mkDerivation {
name = "${name}.tar";
src = stream;
dontUnpack = true;
buildPhase = ''
$src > $out
'';
};
nixSnapshotterRef = imagePath: "nix:0${imagePath}";
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;
}