Create helper function to create NixNG images
Move NixNG images to separate directory
This commit is contained in:
parent
e3ff293c0c
commit
8e09ef5c1e
6 changed files with 31 additions and 39 deletions
|
@ -1,59 +0,0 @@
|
|||
{ 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
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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 = {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
{ 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}"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue