Certbot+DNS+flake upadte

This commit is contained in:
ari committed 2026-06-01 13:32:35 -04:00
1 parent b23ab9be23
commit acafdbbdd2
20 files changed
+393 -180

No files matched your search

+1 -1
View File
@@ -1 +1 @@
/nix/store/4ki9v1ykmxgfin53pjgav9wlcfkf7cj5-pre-commit-config.json
/nix/store/w0az8z0nd9vkl5pzbaqp83b88394y4pr-pre-commit-config.json
+4
View File
@@ -35,6 +35,10 @@ export def "skyg test" [] {
nh os test | print
}
export def "skyg check" [] {
nix flake check --no-build
}
# rollback configuration
export def "skyg rollback" [] {
sudo nixos-rebuild switch --rollback
Generated
+88 -72
View File
@@ -153,12 +153,12 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1776975946,
"narHash": "sha256-h/+pqz7PQ4X8zffxM68fwmyTlalWrlM49W2fT2G/cAs=",
"rev": "26f072a4dddb0433e27aee6516e9e3287db4b8d2",
"revCount": 413,
"lastModified": 1779475417,
"narHash": "sha256-7/U/+X66C7XmLnt5JVJVtpx8wVDRU//Awaeqkq9+NNc=",
"rev": "8a9c57ea6b458a40589df60f26200b7d305354d1",
"revCount": 417,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/3.18.1/019dbc08-210a-7941-b195-710393c6fd8c/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/3.21.0/019e5103-0940-7a50-bac6-f1c621bf31ff/source.tar.gz"
},
"original": {
"type": "tarball",
@@ -168,37 +168,37 @@
"determinate-nixd-aarch64-darwin": {
"flake": false,
"locked": {
"narHash": "sha256-OmmajnGiM5Pvm/yWk6omjOMcmsLgfNvZ5+Dn/UZdH00=",
"narHash": "sha256-LNvx0qZsH8tbdgNfaig/x5Cf4r4UrXfU1m+0bO3D0E4=",
"type": "file",
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.18.1/macOS"
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.21.0/macOS"
},
"original": {
"type": "file",
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.18.1/macOS"
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.21.0/macOS"
}
},
"determinate-nixd-aarch64-linux": {
"flake": false,
"locked": {
"narHash": "sha256-RriiWEs0lLjofbqGVBkUSHuht7rOJaWM98GDOVg4pCM=",
"narHash": "sha256-rKg7uVAEK8X3TTFGaWp8CVZuCAr3wHkMnuJOndhXJF0=",
"type": "file",
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.18.1/aarch64-linux"
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.21.0/aarch64-linux"
},
"original": {
"type": "file",
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.18.1/aarch64-linux"
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.21.0/aarch64-linux"
}
},
"determinate-nixd-x86_64-linux": {
"flake": false,
"locked": {
"narHash": "sha256-8hemqyT1ruFwxVHvMQ8CWUQyQJSHIcMOY+zoRC37klg=",
"narHash": "sha256-vBCUEVPfY4+nxGDM62evpxJYEVqLTqdBGbCkmZ2sQhk=",
"type": "file",
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.18.1/x86_64-linux"
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.21.0/x86_64-linux"
},
"original": {
"type": "file",
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.18.1/x86_64-linux"
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.21.0/x86_64-linux"
}
},
"dms": {
@@ -209,11 +209,11 @@
"quickshell": "quickshell"
},
"locked": {
"lastModified": 1777145534,
"narHash": "sha256-K/DtFratLxaZ4+YS9G+HZA37banWacXYznmul3XPKKM=",
"lastModified": 1777431599,
"narHash": "sha256-g6r/Gx8PTDzO3jCNzzySA+Ff1lmLF9nDlMCNyyoQjoE=",
"owner": "AvengeMedia",
"repo": "DankMaterialShell",
"rev": "bcf41ed5caff19e5750f3ef0594088492ecbadbe",
"rev": "eb5afcdc40ea5446c27e18552ff4a19f9daf9484",
"type": "github"
},
"original": {
@@ -338,11 +338,11 @@
]
},
"locked": {
"lastModified": 1776796298,
"narHash": "sha256-PcRvlWayisPSjd0UcRQbhG8Oqw78AcPE6x872cPRHN8=",
"lastModified": 1778507602,
"narHash": "sha256-kTwur1wV+01SdqskVMSo6JMEpg71ps3HpbFY2GsflKs=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad",
"rev": "61ab0e80d9c7ab14c256b5b453d8b3fb0189ba0a",
"type": "github"
},
"original": {
@@ -445,16 +445,16 @@
]
},
"locked": {
"lastModified": 1775425411,
"narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=",
"lastModified": 1779726825,
"narHash": "sha256-RUkMrREjKDQrA+dA9+xZviGAxM5W1aVdyOr/bSYpHrE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe",
"rev": "b179bde238977f7d4454fc770b1a727eaf55111c",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.11",
"ref": "release-26.05",
"repo": "home-manager",
"type": "github"
}
@@ -705,12 +705,12 @@
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1776973637,
"narHash": "sha256-6dtDAH38Jn658Vty5tULesSWvYj79cK+rtJtJgCUbW0=",
"rev": "4dccfb86b6bc6ae733709c6770cd116ad62d910b",
"revCount": 24973,
"lastModified": 1779472733,
"narHash": "sha256-nV5OHwivEf392cB5MDwoVdDHSvy6Q+rRYZBHd9sePj4=",
"rev": "11f3aff904f84ae612e36e8bc578ac421fca74fa",
"revCount": 25967,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix-src/3.18.1/019dbc00-786e-7020-8304-a33065736bab/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix-src/3.21.0/019e50fb-8633-73d0-b673-b2e265950490/source.tar.gz"
},
"original": {
"type": "tarball",
@@ -724,11 +724,11 @@
]
},
"locked": {
"lastModified": 1775037210,
"narHash": "sha256-KM2WYj6EA7M/FVZVCl3rqWY+TFV5QzSyyGE2gQxeODU=",
"lastModified": 1779036909,
"narHash": "sha256-zXcwYQGCT6pzinK+1dBB2ekTVtfxGZAapb3Evdcu4fY=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "06648f4902343228ce2de79f291dd5a58ee12146",
"rev": "56c666e108467d87d13508936aade6d567f2a501",
"type": "github"
},
"original": {
@@ -739,11 +739,11 @@
},
"nix-flatpak": {
"locked": {
"lastModified": 1777229239,
"narHash": "sha256-OwSaWqlBdKn8QIa7BrPtJmlrr46U7AuwMc/toDKuMZw=",
"lastModified": 1779998907,
"narHash": "sha256-8CSkdFNkAF49pmhFneEFNAO4UX9/0FnoMwXMY3yyvi0=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "3f1d78b63b6af353c0685b8a7411c04d980426e4",
"rev": "744221c2aef17f1f2a13278abfeabd9bd5e40180",
"type": "github"
},
"original": {
@@ -760,11 +760,11 @@
]
},
"locked": {
"lastModified": 1777181277,
"narHash": "sha256-yVJbd07ortDRAttDFmDV5p220aOLTHgVAx//0nW/xW8=",
"lastModified": 1780210899,
"narHash": "sha256-4axz3OBPTKa6LIkXV8n0lc63MQU+et2CB5DGobEAi6k=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "b8eb7acee0f7604fe1bf6a5b3dcf5254369180fa",
"rev": "97df9dc0b7c924344b793a15c1e8e4522ebb854e",
"type": "github"
},
"original": {
@@ -774,12 +774,15 @@
}
},
"nixos-hardware": {
"inputs": {
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1776983936,
"narHash": "sha256-ZOQyNqSvJ8UdrrqU1p7vaFcdL53idK+LOM8oRWEWh6o=",
"lastModified": 1780310866,
"narHash": "sha256-fPBRVf6A5xlACYcOI59shGrjURuvwu0lRsDoSCEXt/I=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "2096f3f411ce46e88a79ae4eafcfc9df8ed41c61",
"rev": "4ed851c979641e28597a05086332d75cdc9e395f",
"type": "github"
},
"original": {
@@ -839,12 +842,12 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1776877367,
"narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=",
"rev": "0726a0ecb6d4e08f6adced58726b95db924cef57",
"revCount": 985613,
"lastModified": 1779560665,
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
"revCount": 1004030,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.985613%2Brev-0726a0ecb6d4e08f6adced58726b95db924cef57/019dc33e-a3ef-7cf1-936a-cf64d10f6c63/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.1004030%2Brev-64c08a7ca051951c8eae34e3e3cb1e202fe36786/019e5fd8-b716-7e01-9710-e44ec43dc50b/source.tar.gz"
},
"original": {
"type": "tarball",
@@ -853,26 +856,26 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1761597516,
"narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=",
"rev": "daf6dc47aa4b44791372d6139ab7b25269184d55",
"revCount": 811874,
"lastModified": 1773222311,
"narHash": "sha256-BHoB/XpbqoZkVYZCfXJXfkR+GXFqwb/4zbWnOr2cRcU=",
"rev": "0590cd39f728e129122770c029970378a79d076a",
"revCount": 909248,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2505.811874%2Brev-daf6dc47aa4b44791372d6139ab7b25269184d55/019a3494-3498-707e-9086-1fb81badc7fe/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2511.909248%2Brev-0590cd39f728e129122770c029970378a79d076a/019ce32b-8ace-7339-b129-cceaa8dd10c6/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.2505"
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.2511"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1776329215,
"narHash": "sha256-a8BYi3mzoJ/AcJP8UldOx8emoPRLeWqALZWu4ZvjPXw=",
"rev": "b86751bc4085f48661017fa226dee99fab6c651b",
"revCount": 981196,
"lastModified": 1778869304,
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
"revCount": 998534,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.981196%2Brev-b86751bc4085f48661017fa226dee99fab6c651b/019daeab-1563-75e1-9919-fee0062268db/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.998534%2Brev-d233902339c02a9c334e7e593de68855ad26c4cb/019e3efc-e09a-7ff1-b05f-0c8f85ba7441/source.tar.gz"
},
"original": {
"type": "tarball",
@@ -897,12 +900,25 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1777077449,
"narHash": "sha256-AIiMJiqvGrN4HyLEbKAoCSRRYn0rnlW5VbKNIMIYqm4=",
"rev": "a4bf06618f0b5ee50f14ed8f0da77d34ecc19160",
"revCount": 911667,
"lastModified": 1767892417,
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
"rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2511.911667%2Brev-a4bf06618f0b5ee50f14ed8f0da77d34ecc19160/019dcae8-75b0-71d1-abd5-feab9658f0fa/source.tar.gz"
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre924538.3497aa5c9457/nixexprs.tar.xz"
},
"original": {
"type": "tarball",
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1780203844,
"narHash": "sha256-K5sT4jTpGs15ADhviMKNBH38REpPf5Q6mM1+N6cArVE=",
"rev": "b51242d7d43689db2f3be91bd05d5b24fbb469c4",
"revCount": 1005180,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2605.1005180%2Brev-b51242d7d43689db2f3be91bd05d5b24fbb469c4/019e820b-3e9f-7ad0-acdd-dab08fdf665f/source.tar.gz"
},
"original": {
"type": "tarball",
@@ -917,11 +933,11 @@
"noctalia-qs": "noctalia-qs"
},
"locked": {
"lastModified": 1778075743,
"narHash": "sha256-WB5zYuFT69KUGa1ou+aMGNGxV/9e5EaqxF3IltN6BxY=",
"lastModified": 1780322768,
"narHash": "sha256-WnjyKaA+kywlyaPZs3dxD+XWVCMixsfDht8Sn7fshgs=",
"owner": "noctalia-dev",
"repo": "noctalia-shell",
"rev": "3bbf31945de508409e3a3ded08cc154f185c42fb",
"rev": "fe6fa125f5ee7881c4ee0cf9c0a4329a8238d3c2",
"type": "github"
},
"original": {
@@ -940,11 +956,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1777773024,
"narHash": "sha256-pLU+KB84A0Jei/vTD6pOS4Ovkmq3QDfPQHg1MlKsRqM=",
"lastModified": 1780194487,
"narHash": "sha256-M+YtjKCTkHrkplNaKVyaxfa8hAWjRF6wFOUBAZvxQ4U=",
"owner": "noctalia-dev",
"repo": "noctalia-qs",
"rev": "d3e26ccd9eecde9139be00caf5dc2d4260fb31ee",
"rev": "07398e12b54f194e3a2d47c87e3fd10b8eeaa27d",
"type": "github"
},
"original": {
@@ -1012,7 +1028,7 @@
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_5",
"nixpkgs": "nixpkgs_6",
"nixpkgs-unstable": "nixpkgs-unstable",
"noctalia": "noctalia",
"stylix": "stylix",
@@ -1040,11 +1056,11 @@
"tinted-zed": "tinted-zed"
},
"locked": {
"lastModified": 1776894428,
"narHash": "sha256-wuT915MyCtMTfLj+uo9y8wtCwkEgJXiXvcbSleFrlN0=",
"lastModified": 1778680496,
"narHash": "sha256-tUq1WASV0dHLv3j18log8V6Esq0NYkXuzNH2EHsstcg=",
"owner": "nix-community",
"repo": "stylix",
"rev": "f34be27ce83efaa1c85ad1e5b1f8b6dea65b147d",
"rev": "fc5bec2e44678eeaa221d566d447a0257a884737",
"type": "github"
},
"original": {
+1 -1
View File
@@ -31,7 +31,7 @@
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=main";
# Home manager
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# Themes
+4 -2
View File
@@ -230,8 +230,10 @@ in
enable = true;
host = "0.0.0.0";
port = 11434;
acceleration = "rocm";
rocmOverrideGfx = "11.0.2";
package = pkgs.ollama-rocm;
environmentVariables = {
HSA_OVERRIDE_GFX_VERSION = "11.0.2";
};
};
# # Display Managers
services.xserver.videoDrivers = [
+3 -5
View File
@@ -78,7 +78,7 @@ in
services.tailscale.enable = true;
# Desktop Env
services.displayManager.gdm.enable = true;
services.displayManager.gdm.wayland = true;
services.displayManager.defaultSession = "niri";
# Firmware updater
services.fwupd.enable = true;
@@ -139,11 +139,10 @@ in
enable = true;
host = "0.0.0.0";
port = ports.ollama;
acceleration = "vulkan";
package = pkgs.ollama-vulkan;
user = "ollama";
home = "/var/lib/ollama";
rocmOverrideGfx = "gfx1151";
# rocmOverrideGfx = "11.5.1";
environmentVariables = {
# Stability fix — SDMA is buggy on Strix Halo unified memory
@@ -176,7 +175,6 @@ in
enable = true;
uri = "tcp://0.0.0.0:${toString ports.piper}";
voice = "en_US-danny-low";
streaming = true;
};
faster-whisper.servers.todd = {
enable = true;
+1 -1
View File
@@ -2,7 +2,7 @@
{
skyg.user.enable = true;
skyg.nixos.common.ssh-server.enable = true;
skyg.server.dns = {
skyg.server.dns.routing = {
enable = true;
openFirewall = true;
addressesSecretName = "dns-addresses.conf";
+12 -1
View File
@@ -24,7 +24,7 @@ in
{
skyg.user.enable = true;
skyg.nixos.common.ssh-server.enable = true;
skyg.server.dns = {
skyg.server.dns.routing = {
enable = false;
openFirewall = true;
addressesSecretName = "dns-addresses.conf";
@@ -87,6 +87,17 @@ in
};
};
};
# Certbot TLS service
skyg.server.dns.certbot = {
enable = false;
email = "admin@skyg.ca";
publicDomains = [
".*skyg.ca"
".*home.sosnovsky.ca"
];
};
# Firewall
networking.firewall.allowedUDPPorts = openPorts;
networking.firewall.allowedTCPPorts = openPorts;
+1 -1
View File
@@ -2,7 +2,7 @@
{
skyg.user.enable = true;
skyg.nixos.common.ssh-server.enable = true;
skyg.server.dns = {
skyg.server.dns.routing = {
enable = false;
openFirewall = true;
addressesSecretName = "dns-addresses.conf";
+1 -1
View File
@@ -3,7 +3,7 @@
{
skyg.user.enable = true;
skyg.nixos.common.ssh-server.enable = true;
skyg.server.dns = {
skyg.server.dns.routing = {
enable = false;
openFirewall = true;
addressesSecretName = "dns-addresses.conf";
+1 -1
View File
@@ -17,7 +17,7 @@ in
{
skyg.user.enable = true;
skyg.nixos.common.ssh-server.enable = true;
skyg.server.dns = {
skyg.server.dns.routing = {
enable = false;
openFirewall = true;
addressesSecretName = "dns-addresses.conf";
+1 -1
View File
@@ -13,7 +13,7 @@ in
options = {
skyg.home-manager.version = mkOption {
type = types.str;
default = "24.11";
default = "26.05";
description = "The home-manager state version";
};
skyg.home-manager.extraImports = mkOption {
+1 -1
View File
@@ -1,4 +1,4 @@
{ stateVersion ? "24.11" }:
{ stateVersion ? "26.05" }:
let
makeCommonGitConfigs = (import ./git.nix).makeCommonGitConfigs;
programsModule = (import ./programs.nix);
+5 -5
View File
@@ -72,7 +72,7 @@ in
makeNixOs =
{ system ? "x86_64-linux"
, hostName
, systemStateVersion ? "24.05"
, systemStateVersion ? "26.05"
, configuration ? [ ]
}: nixpkgs.lib.nixosSystem {
specialArgs = specialArgs // {
@@ -93,8 +93,8 @@ in
makeIso =
{ system ? "x86_64-linux"
, hostName
, systemStateVersion ? "25.11"
, homeManagerVersion ? "25.11"
, systemStateVersion ? "26.05"
, homeManagerVersion ? "26.05"
, configuration ? [ ]
}: nixpkgs.lib.nixosSystem {
specialArgs = specialArgs // {
@@ -118,8 +118,8 @@ in
makeDarwinModule =
{ system ? "x86_64-darwin"
, user
, homeManagerVersion ? "25.11"
, systemStateVersion ? "25.11"
, homeManagerVersion ? "26.05"
, systemStateVersion ? "26.05"
, hostName
, configuration ? [ ]
}:
+1 -1
View File
@@ -16,6 +16,6 @@
email = lib.mkDefault user.email;
};
skyg.core.hostName = hostName;
skyg.home-manager.version = lib.mkDefault "24.11";
skyg.home-manager.version = lib.mkDefault "26.05";
system.stateVersion = systemStateVersion;
}
+1
View File
@@ -9,5 +9,6 @@
./services
./timers.nix
./dns
./certbot.nix
];
}
@@ -0,0 +1,74 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.skyg.server.dns.certbot;
in
{
options = {
skyg.server.dns.certbot = {
enable = mkEnableOption "Let's Encrypt certificate management with certbot for DNS domains";
publicDomains = mkOption {
description = "List of public domains for which to obtain Let's Encrypt certificates";
type = types.listOf types.str;
default = [ ];
};
email = mkOption {
description = "Email address for Let's Encrypt account registration";
type = types.str;
example = "admin@example.com";
};
testMode = mkOption {
description = "Use certbot in test mode (dry-run) for development/testing";
type = types.bool;
default = false;
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.certbot pkgs.certbot-nginx ];
# Set up systemd service for certificate renewal
systemd.services.certbot-renew = {
description = "Renew Let's Encrypt certificates";
serviceConfig = {
Type = "oneshot";
User = "root";
ExecStart =
if cfg.testMode then
"${pkgs.certbot}/bin/certbot renew --dry-run --nginx"
else
"${pkgs.certbot}/bin/certbot renew --nginx";
};
};
# Set up systemd timer for certificate renewal
systemd.timers.certbot-renew = {
description = "Daily renewal of Let's Encrypt certificates";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "daily";
Persistent = true;
};
};
# Enable the renewal timer
systemd.timers.certbot-renew.enable = true;
# Configure nginx with virtual hosts for public domains
services.nginx = {
enable = true;
};
# Create a simple certbot command that can be run manually
environment.shellAliases = {
"certbot-get-certs" =
"${pkgs.certbot}/bin/certbot certonly --nginx --non-interactive --agree-tos --email ${cfg.email} --expand ${concatMapStrings (domain: " --domains ${domain}") cfg.publicDomains}";
};
};
}
+6 -86
View File
@@ -1,88 +1,8 @@
{ config, lib, ... }:
with lib;
let
cfg = config.skyg.server.dns;
# Each { domain, ip } generates both exact and wildcard dnsmasq address entries
addressEntries = concatMap
({ domain, ip }: [
"/${domain}/${ip}"
"/.${domain}/${ip}"
])
cfg.addresses;
in
{ ... }:
{
options = {
skyg.server.dns = {
enable = mkEnableOption "local DNS resolver via dnsmasq";
addresses = mkOption {
description = "Static domain-to-IP mappings. Each entry generates both exact and wildcard dnsmasq address= entries.";
type = types.listOf (types.submodule {
options = {
domain = mkOption { type = types.str; };
ip = mkOption { type = types.str; };
};
});
default = [ ];
};
addressesSecretName = mkOption {
description = ''
Name of an agenix secret whose decrypted content is a dnsmasq config
fragment (address= lines). Included via dnsmasq conf-file. Set null to skip.
'';
type = types.nullOr types.str;
default = null;
example = "dns-addresses.conf";
};
upstreamServers = mkOption {
description = "Upstream DNS servers to forward unresolved queries to.";
type = types.listOf types.str;
default = [ "1.1.1.1" "1.0.0.1" ];
};
listenAddresses = mkOption {
description = "IPs to bind. Empty list means listen on all interfaces (dnsmasq default).";
type = types.listOf types.str;
default = [ ];
};
openFirewall = mkOption {
description = "Open port 53 UDP/TCP in the firewall.";
type = types.bool;
default = false;
};
};
};
config = mkIf cfg.enable {
age.secrets = mkIf (cfg.addressesSecretName != null) {
${cfg.addressesSecretName} = {
file = ../../../../secrets + "/${cfg.addressesSecretName}.age";
};
};
services.dnsmasq = {
enable = true;
settings = {
address = addressEntries;
server = cfg.upstreamServers;
}
// optionalAttrs (cfg.listenAddresses != [ ]) {
listen-address = cfg.listenAddresses;
}
// optionalAttrs (cfg.addressesSecretName != null) {
conf-file = config.age.secrets.${cfg.addressesSecretName}.path;
};
};
networking.firewall = mkIf cfg.openFirewall {
allowedUDPPorts = [ 53 ];
allowedTCPPorts = [ 53 ];
};
};
imports = [
./certbot
./routing
./local-ca
];
}
@@ -0,0 +1,99 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.skyg.server.dns.local-ca;
in
{
options = {
skyg.server.dns.local-ca = {
enable = mkEnableOption "Local Certificate Authority for DNS domains";
caCert = mkOption {
description = "Path to the local CA certificate";
type = types.str;
default = "/etc/ssl/local-ca/cert.pem";
};
caKey = mkOption {
description = "Path to the local CA private key";
type = types.str;
default = "/etc/ssl/local-ca/key.pem";
};
domain = mkOption {
description = "Domain name for the local CA";
type = types.str;
default = "local-ca.skyg.internal";
};
organizationalUnit = mkOption {
description = "Organizational unit for the local CA certificate";
type = types.str;
default = "Skyg Internal CA";
};
organization = mkOption {
description = "Organization for the local CA certificate";
type = types.str;
default = "Skyg";
};
country = mkOption {
description = "Country code for the local CA certificate";
type = types.str;
default = "CA";
};
email = mkOption {
description = "Email address for the local CA";
type = types.str;
default = "admin@skyg.ca";
};
certificateLifetime = mkOption {
description = "Certificate lifetime in days";
type = types.int;
default = 365;
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.openssl ];
# Create directory for local CA
environment.etc."ssl/local-ca" = {
recursive = true;
owner = "root";
group = "root";
mode = "0755";
};
# Create local CA certificate (this would typically be generated by a script)
# For now, we'll just set up the structure and configuration
systemd.services.local-ca-setup = {
description = "Setup local Certificate Authority";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = ''
mkdir -p /etc/ssl/local-ca
# In a real implementation, you would generate the CA certificate here
# openssl req -new -x509 -nodes -days ${toString cfg.certificateLifetime} \
# -subj "/C=${cfg.country}/O=${cfg.organization}/OU=${cfg.organizationalUnit}/CN=${cfg.domain}/emailAddress=${cfg.email}" \
# -keyout ${cfg.caKey} -out ${cfg.caCert}
'';
User = "root";
};
};
# Configuration for services to trust local CA
environment.etc."ssl/certs/ca-certificates.crt".text = ''
# Local CA certificates would be added here
# This is a placeholder for where local CA certs would be included
'';
};
}
@@ -0,0 +1,88 @@
{ config, lib, ... }:
with lib;
let
cfg = config.skyg.server.dns.routing;
# Each { domain, ip } generates both exact and wildcard dnsmasq address entries
addressEntries = concatMap
({ domain, ip }: [
"/${domain}/${ip}"
"/.${domain}/${ip}"
])
cfg.addresses;
in
{
options = {
skyg.server.dns.routing = {
enable = mkEnableOption "local DNS resolver via dnsmasq";
addresses = mkOption {
description = "Static domain-to-IP mappings. Each entry generates both exact and wildcard dnsmasq address= entries.";
type = types.listOf (types.submodule {
options = {
domain = mkOption { type = types.str; };
ip = mkOption { type = types.str; };
};
});
default = [ ];
};
addressesSecretName = mkOption {
description = ''
Name of an agenix secret whose decrypted content is a dnsmasq config
fragment (address= lines). Included via dnsmasq conf-file. Set null to skip.
'';
type = types.nullOr types.str;
default = null;
example = "dns-addresses.conf";
};
upstreamServers = mkOption {
description = "Upstream DNS servers to forward unresolved queries to.";
type = types.listOf types.str;
default = [ "1.1.1.1" "1.0.0.1" ];
};
listenAddresses = mkOption {
description = "IPs to bind. Empty list means listen on all interfaces (dnsmasq default).";
type = types.listOf types.str;
default = [ ];
};
openFirewall = mkOption {
description = "Open port 53 UDP/TCP in the firewall.";
type = types.bool;
default = false;
};
};
};
config = mkIf cfg.enable {
age.secrets = mkIf (cfg.addressesSecretName != null) {
${cfg.addressesSecretName} = {
file = ../../../../secrets + "/${cfg.addressesSecretName}.age";
};
};
services.dnsmasq = {
enable = true;
settings = {
address = addressEntries;
server = cfg.upstreamServers;
}
// optionalAttrs (cfg.listenAddresses != [ ]) {
listen-address = cfg.listenAddresses;
}
// optionalAttrs (cfg.addressesSecretName != null) {
conf-file = config.age.secrets.${cfg.addressesSecretName}.path;
};
};
networking.firewall = mkIf cfg.openFirewall {
allowedUDPPorts = [ 53 ];
allowedTCPPorts = [ 53 ];
};
};
}