diff --git a/systems/x86_64-linux/stargate/default.nix b/systems/x86_64-linux/stargate/default.nix index e0a6417..43a3190 100644 --- a/systems/x86_64-linux/stargate/default.nix +++ b/systems/x86_64-linux/stargate/default.nix @@ -79,6 +79,28 @@ in { }; }; + services.zfs.zed.settings = { + ZED_DEBUG_LOG = "/tmp/zed.debug.log"; + ZED_NTFY_URL = "ntfy.kylekrein.com"; + ZED_NTFY_TOPIC = "zed"; + + ZED_NOTIFY_INTERVAL_SECS = 3600; + ZED_NOTIFY_VERBOSE = true; + + ZED_USE_ENCLOSURE_LEDS = true; + ZED_SCRUB_AFTER_RESILVER = true; + }; + + services.smartd = { + enable = true; + autodetect = true; + notifications.mail = { + enable = true; + recipient = "smartd@localhost.com"; + sender = "smartd@smartd.com"; + }; + }; + custom.presets.disko.impermanenceBtrfsLuks = { enable = true; swapSize = null; diff --git a/systems/x86_64-linux/stargate/powersave.nix b/systems/x86_64-linux/stargate/powersave.nix index a4e7b90..4b92100 100644 --- a/systems/x86_64-linux/stargate/powersave.nix +++ b/systems/x86_64-linux/stargate/powersave.nix @@ -8,17 +8,14 @@ environment.systemPackages = with pkgs; [ powertop ]; - services.udev.extraRules = let - mkRule = as: lib.concatStringsSep ", " as; - mkRules = rs: lib.concatStringsSep "\n" rs; - in - mkRules [ - (mkRule [ - ''ACTION=="add|change"'' - ''SUBSYSTEM=="block"'' - ''KERNEL=="sd[a-z]"'' - ''ATTR{queue/rotational}=="1"'' - ''RUN+="${pkgs.hdparm}/bin/hdparm -B 90 -S ${builtins.toString (30 * 60 / 5)} /dev/%k"'' - ]) - ]; + systemd.services.hd-idle = { + enable = false; + description = "External HD spin down daemon"; + wantedBy = ["multi-user.target"]; + serviceConfig = { + Type = "forking"; + ExecStart = "${pkgs.hd-idle}/bin/hd-idle -i 1800 -l /var/log/hd-idle.log"; + ExecReload = "pkill hd-idle"; + }; + }; } diff --git a/systems/x86_64-linux/stargate/services/nginx.nix b/systems/x86_64-linux/stargate/services/nginx.nix index e2defab..2ea9990 100644 --- a/systems/x86_64-linux/stargate/services/nginx.nix +++ b/systems/x86_64-linux/stargate/services/nginx.nix @@ -77,6 +77,7 @@ in { forceSSL = true; locations."/" = { proxyPass = "http://[::1]${config.services.ntfy-sh.settings.listen-http}"; + proxyWebsockets = true; }; }; "paperless.kylekrein.com" = { diff --git a/systems/x86_64-linux/stargate/services/ntfy-sh.nix b/systems/x86_64-linux/stargate/services/ntfy-sh.nix index 7c40f6a..5cbd260 100644 --- a/systems/x86_64-linux/stargate/services/ntfy-sh.nix +++ b/systems/x86_64-linux/stargate/services/ntfy-sh.nix @@ -18,9 +18,37 @@ with lib.custom; { settings = { base-url = "https://ntfy.kylekrein.com"; listen-http = ":9000"; - auth-default-access = "deny-all"; + #auth-default-access = "read-only"; + smtp-server-listen = ":1299"; + smtp-server-domain = "localhost.com"; behind-proxy = true; - enable-login = false; + enable-login = true; + cache-file = "/var/lib/ntfy-sh/cache-file.db"; + auth-file = "/var/lib/ntfy-sh/user.db"; + attachment-cache-dir = "/var/lib/ntfy-sh/attachments"; + }; + }; + + services.postfix = { + enable = true; + config = { + myhostname = "stargate.local"; + mydestination = "localhost, localhost.com"; + relayhost = ""; + transport_maps = "hash:/etc/postfix.conf"; + }; + }; + + environment.etc."postfix.conf".text = '' + localhost.com smtp:[127.0.0.1]:1299 + ''; + systemd.services.postmap-transport = { + description = "Generate postfix transport.db from transport"; + wantedBy = ["multi-user.target"]; + before = ["postfix.service"]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.postfix}/bin/postmap /etc/postfix.conf"; }; }; }