This commit is contained in:
mjallen18
2026-04-08 15:08:00 -05:00
parent 025ab854f0
commit 3af0d99f98
4 changed files with 23 additions and 8 deletions

View File

@@ -7,6 +7,7 @@
}: }:
with lib; with lib;
let let
inherit (lib.${namespace}) mkOpt mkBoolOpt;
name = "attic"; name = "attic";
cfg = config.${namespace}.services.${name}; cfg = config.${namespace}.services.${name};
@@ -24,7 +25,12 @@ let
atticConfig = lib.${namespace}.mkModule { atticConfig = lib.${namespace}.mkModule {
inherit config name; inherit config name;
description = "attic Service"; description = "attic Service";
options = { }; options = {
ntfy = {
enable = mkBoolOpt false "Enable ntfy notifications for cache rebuild failures";
envFile = mkOpt types.str "" "Path to the environment file containing NTFY_USER and NTFY_PASSWORD";
};
};
moduleConfig = { moduleConfig = {
services.atticd = { services.atticd = {
inherit (cfg) environmentFile; inherit (cfg) environmentFile;
@@ -71,9 +77,13 @@ let
StandardError = "journal+console"; StandardError = "journal+console";
Restart = "no"; Restart = "no";
TimeoutStartSec = "2h"; TimeoutStartSec = "2h";
EnvironmentFile = [ config.sops.templates."ntfy.env".path ]; }
// lib.optionalAttrs cfg.ntfy.enable {
EnvironmentFile = [ cfg.ntfy.envFile ];
};
unitConfig = lib.optionalAttrs cfg.ntfy.enable {
OnFailure = "nix-rebuild-cache-notify-failure.service";
}; };
unitConfig.OnFailure = "nix-rebuild-cache-notify-failure.service";
path = with pkgs; [ path = with pkgs; [
nix nix
git git
@@ -125,13 +135,14 @@ let
fi; fi;
''; '';
}; };
}
// lib.optionalAttrs cfg.ntfy.enable {
nix-rebuild-cache-notify-failure = { nix-rebuild-cache-notify-failure = {
description = "Notify ntfy on nix-rebuild-cache failure"; description = "Notify ntfy on nix-rebuild-cache failure";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${ntfyFailScript}"; ExecStart = "${ntfyFailScript}";
EnvironmentFile = [ config.sops.templates."ntfy.env".path ]; EnvironmentFile = [ cfg.ntfy.envFile ];
}; };
}; };
}; };

View File

@@ -52,7 +52,7 @@ let
name = "node-exporter-full.json"; name = "node-exporter-full.json";
path = patchDashboard "node-exporter-full.json" (pkgs.fetchurl { path = patchDashboard "node-exporter-full.json" (pkgs.fetchurl {
url = "https://grafana.com/api/dashboards/1860/revisions/latest/download"; url = "https://grafana.com/api/dashboards/1860/revisions/latest/download";
sha256 = "sha256-mEWSdsTn1EKpW6xoJv/s0XST46EOoUPbDugQwyngIss="; sha256 = "sha256-IeQ72CZhtckDEihcVLhAFuSs77uWsZSENsdomSrWTHo=";
}) "ds_prometheus"; }) "ds_prometheus";
} }
{ {

View File

@@ -26,10 +26,14 @@ in
}; };
arrs.enable = true; arrs.enable = true;
attic = { attic = {
enable = true; enable = false;
port = 9012; port = 9012;
listenAddress = "[::]"; listenAddress = "[::]";
environmentFile = "/run/secrets/jallen-nas/attic-key"; environmentFile = "/run/secrets/jallen-nas/attic-key";
ntfy = {
enable = true;
envFile = config.sops.templates."ntfy.env".path;
};
reverseProxy = { reverseProxy = {
enable = true; enable = true;
subdomain = "cache"; subdomain = "cache";

View File

@@ -9,7 +9,7 @@ in
boot = { boot = {
inherit kernelPackages; inherit kernelPackages;
kernelParams = [ "amd_iommu=pgtbl_v2" ]; kernelParams = [ "amd_iommu=on" ];
initrd = { initrd = {
supportedFilesystems = { supportedFilesystems = {