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

59
images/attic.nix Normal file
View file

@ -0,0 +1,59 @@
{ nixpkgs, nglib, ... }:
nglib.makeSystem {
inherit nixpkgs;
system = "x86_64-linux";
name = "nixng-attic";
config = { ... }: {
dumb-init = {
enable = true;
type.services = { };
};
init.services.attic = {
shutdownOnExit = true;
};
services.attic = {
enable = true;
settings = {
# The '+" is to explicitly denote the end of the Vals expression.
# This is done because we quote the template for the toml file.
# See: https://github.com/helmfile/vals?tab=readme-ov-file#expression-syntax
# database.url = "ref+sops://secrets.yml#attic/databaseURL+";
database = { };
storage = {
type = "local";
path = "/var/lib/atticd/storage";
};
listen = "[::]:8080";
# Data chunking
#
# Warning: If you change any of the values here, it will be
# difficult to reuse existing chunks for newly-uploaded NARs
# since the cutpoints will be different. As a result, the
# deduplication ratio will suffer for a while after the change.
chunking = {
# The minimum NAR size to trigger chunking
#
# If 0, chunking is disabled entirely for newly-uploaded NARs.
# If 1, all NARs are chunked.
nar-size-threshold = 64 * 1024; # 64 KiB
# The preferred minimum size of a chunk, in bytes
min-size = 16 * 1024; # 16 KiB
# The preferred average size of a chunk, in bytes
avg-size = 64 * 1024; # 64 KiB
# The preferred maximum size of a chunk, in bytes
max-size = 256 * 1024; # 256 KiB
};
};
};
};
}

41
images/dnsmasq.nix Normal file
View file

@ -0,0 +1,41 @@
{ globals, nixpkgs, nglib, ... }:
nglib.makeSystem {
inherit nixpkgs;
system = "x86_64-linux";
name = "nixng-dnsmasq";
config = { ... }: {
dumb-init = {
enable = true;
type.services = { };
};
init.services.dnsmasq = {
shutdownOnExit = true;
};
services.dnsmasq = {
enable = true;
settings = {
address = [
"/kms.kun.is/${globals.kmsIPv4}"
"/ssh.git.kun.is/${globals.gitIPv4}"
];
alias = "${globals.routerPublicIPv4},${globals.traefikIPv4}";
expand-hosts = true;
local = "/dmz/";
log-queries = true;
no-hosts = true;
no-resolv = true;
port = 53;
server = [
"192.168.30.1"
"/kun.is/${globals.bind9IPv4}"
];
};
};
};
}