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
modules

View file

@ -1,21 +1,4 @@
{ nixpkgs, pkgs, lib, nixng, config, globals, ... }:
let
atticStream = (import ./attic-image.nix {
inherit nixpkgs nixng globals;
inherit (nixng) nglib;
}).config.system.build.ociImage.stream;
atticImage = pkgs.stdenv.mkDerivation {
name = "attic.tar";
src = atticStream;
dontUnpack = true;
buildPhase = ''
$src > $out
'';
};
in
{
{ self, utils, lib, config, globals, ... }: {
options.attic.enable = lib.mkEnableOption "attic";
config = lib.mkIf config.attic.enable {
@ -52,7 +35,7 @@ in
spec = {
containers.attic = {
image = "nix:0${atticImage}";
image = utils.nixSnapshotterRef (utils.mkNixNGImage "attic" "${self}/images/attic.nix");
ports.web.containerPort = 8080;
env = {