From 2e3dad1c1b33380d5e3169f2396ac3c4b83f4a28 Mon Sep 17 00:00:00 2001 From: marc Date: Fri, 16 Feb 2024 20:37:07 +0100 Subject: [PATCH] Added Thingvellir nomad volumes --- config/nomad.d/host-thingvellir.json | 33 ++++++++++++++++++++++++++++ hosts/thingvellir/default.nix | 1 + modules/server/nomad.nix | 12 ++++++++++ 3 files changed, 46 insertions(+) create mode 100644 config/nomad.d/host-thingvellir.json diff --git a/config/nomad.d/host-thingvellir.json b/config/nomad.d/host-thingvellir.json new file mode 100644 index 0000000..4205232 --- /dev/null +++ b/config/nomad.d/host-thingvellir.json @@ -0,0 +1,33 @@ +{ + "client": { + "host_network": { + "public": { + "interface": "ens3", + "reserved_ports": "80,443,2222" + } + }, + "host_volume": { + "dns-unbound": { + "path": "/var/lib/nomad_volumes/dns/unbound", + "read_only": false + }, + "dns-pihole": { + "path": "/var/lib/nomad_volumes/dns/pihole/etc-pihole", + "read_only": false + }, + "dns-dnsmasq": { + "path": "/var/lib/nomad_volumes/dns/pihole/etc-dnsmasq.d", + "read_only": false + }, + + "caddyfile": { + "path": "/var/lib/nomad_volumes/caddy/Caddyfile", + "read_only": false + }, + "caddy-data": { + "path": "/var/lib/nomad_volumes/caddy/data", + "read_only": false + } + } + } +} diff --git a/hosts/thingvellir/default.nix b/hosts/thingvellir/default.nix index 5128f04..e4767da 100644 --- a/hosts/thingvellir/default.nix +++ b/hosts/thingvellir/default.nix @@ -53,6 +53,7 @@ with lib; server.nomad = { enable = true; server = true; + host-config = ../../config/nomad.d/host-thingvellir.json; }; # - Editors and development ------------------ diff --git a/modules/server/nomad.nix b/modules/server/nomad.nix index 1aae9fe..bbf6f98 100644 --- a/modules/server/nomad.nix +++ b/modules/server/nomad.nix @@ -13,6 +13,12 @@ in description = "Set to true if configured a server - otherwise a client is assumed"; }; + host-config = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + description = "Additional host-specific config file"; + }; + }; config = lib.mkIf cfg.enable { # services.consul.enable = true; @@ -45,6 +51,12 @@ in target = "nomad.d/server.json"; source = ../../config/nomad.d/server.json; }; + } // lib.optionalAttrs cfg.host-config { + # Host-specific configuration + nomad-host-cfg = { + target = "nomad.d/host.json"; + source = cfg.host-config; + }; }; age.secrets = {