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

View file

@ -1,20 +1,4 @@
{ nixpkgs, pkgs, nixng, globals, config, lib, ... }:
let
dnsmasqStream = (import ./dnsmasq-image.nix {
inherit nixpkgs nixng globals;
inherit (nixng) nglib;
}).config.system.build.ociImage.stream;
dnsmasqImage = pkgs.stdenv.mkDerivation {
name = "dnsmasq.tar";
src = dnsmasqStream;
dontUnpack = true;
buildPhase = ''
$src > $out
'';
};
in
{
{ self, utils, globals, config, lib, ... }: {
options.dnsmasq.enable = lib.mkEnableOption "dnsmasq";
config = lib.mkIf config.dnsmasq.enable {
@ -26,7 +10,7 @@ in
metadata.labels.app = "dnsmasq";
spec.containers.dnsmasq = {
image = "nix:0${dnsmasqImage}";
image = utils.nixSnapshotterRef (utils.mkNixNGImage "dnsmasq" "${self}/images/dnsmasq.nix");
imagePullPolicy = "Always";
ports.dns = {