Create helper function to create NixNG images

Move NixNG images to separate directory
This commit is contained in:
Pim Kunis 2024-10-01 22:51:08 +02:00
parent e3ff293c0c
commit 8e09ef5c1e
6 changed files with 31 additions and 39 deletions

19
utils.nix Normal file
View file

@ -0,0 +1,19 @@
{ pkgs, nixpkgs, nixng, globals, ... }: {
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}";
}