From 8bcbcb576846e68944f643e698585a36fdaf4417 Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 10 Sep 2024 20:59:00 -0400 Subject: [PATCH] Services: cleanup --- flake.lock | 8 ++-- hosts/Hevana/default.nix | 14 ------ modules/services/deluge.nix | 58 ------------------------ modules/services/transmission.nix | 75 ------------------------------- secrets | 2 +- 5 files changed, 5 insertions(+), 152 deletions(-) delete mode 100644 modules/services/deluge.nix delete mode 100644 modules/services/transmission.nix diff --git a/flake.lock b/flake.lock index 68bb36d..ef9f994 100644 --- a/flake.lock +++ b/flake.lock @@ -378,11 +378,11 @@ "secrets": { "flake": false, "locked": { - "lastModified": 1726013710, - "narHash": "sha256-0xzIUXzp3P5sUVB2XLmtxXoxleqHdSw9j/hpbcOCpRg=", + "lastModified": 1726016318, + "narHash": "sha256-0pvkDJhDPRY0TkeJ4Wh4tjliPA+q+DZZZmBMRsUHvMw=", "ref": "refs/heads/main", - "rev": "967332abfd758e3922cb676fd594a220f9b0fa8f", - "revCount": 73, + "rev": "2fc0eb462b4f2333ac0d9eb9cb2405e05afe66f7", + "revCount": 74, "type": "git", "url": "file:./secrets" }, diff --git a/hosts/Hevana/default.nix b/hosts/Hevana/default.nix index 9fde542..5f50be2 100644 --- a/hosts/Hevana/default.nix +++ b/hosts/Hevana/default.nix @@ -120,11 +120,6 @@ in user = config.users.users.aires.name; }; boinc.enable = true; - deluge = { - enable = true; - home = "${services-root}/deluge"; - url = config.secrets.services.deluge.url; - }; duplicacy-web = { enable = true; home = "/storage/backups/settings/Haven"; @@ -195,15 +190,6 @@ in enable = true; ports = [ config.secrets.hosts.dimaga.ssh.port ]; }; - transmission = { - enable = false; - home = "${services-root}/transmission"; - url = config.secrets.services.transmission.url; - auth = { - user = config.users.users.aires.name; - password = config.secrets.services.transmission.password; - }; - }; virtualization.host = { enable = true; user = "aires"; diff --git a/modules/services/deluge.nix b/modules/services/deluge.nix deleted file mode 100644 index 03e2043..0000000 --- a/modules/services/deluge.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - cfg = config.aux.system.services.deluge; -in -{ - options = { - aux.system.services.deluge = { - enable = lib.mkEnableOption "Enables Deluge."; - home = lib.mkOption { - default = "/var/lib/deluge"; - type = lib.types.str; - description = "Where to store Deluge's files"; - }; - url = lib.mkOption { - default = ""; - type = lib.types.str; - description = "The complete URL where Deluge is hosted."; - example = "https://deluge.example.com"; - }; - }; - - }; - - config = lib.mkIf cfg.enable { - services = { - nginx.virtualHosts."${cfg.url}" = { - useACMEHost = pkgs.util.getDomainFromURL cfg.url; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:8112"; - extraConfig = '' - proxy_set_header X-Deluge-Base "/"; - add_header X-Frame-Options SAMEORIGIN; - ''; - }; - }; - deluge = { - enable = true; - dataDir = cfg.home; - web = { - enable = true; - openFirewall = false; # Not needed since we're using a reverse proxy - }; - }; - }; - - systemd.services = { - deluge.unitConfig.RequiresMountsFor = cfg.home; - nginx.wants = [ config.systemd.services.deluge.name ]; - }; - }; -} diff --git a/modules/services/transmission.nix b/modules/services/transmission.nix deleted file mode 100644 index 23d9a33..0000000 --- a/modules/services/transmission.nix +++ /dev/null @@ -1,75 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - cfg = config.aux.system.services.transmission; -in -{ - options = { - aux.system.services.transmission = { - enable = lib.mkEnableOption "Enables Transmission."; - home = lib.mkOption { - default = "/var/lib/transmission"; - type = lib.types.str; - description = "Where to store Transmission's files"; - }; - auth = { - user = lib.mkOption { - default = "transmission"; - type = lib.types.str; - description = "Username for basic auth."; - }; - password = lib.mkOption { - default = "transmission"; - type = lib.types.str; - description = "Password for basic auth."; - }; - }; - url = lib.mkOption { - default = ""; - type = lib.types.str; - description = "The complete URL where Transmission is hosted."; - example = "https://transmission.example.com"; - }; - }; - - }; - - config = lib.mkIf cfg.enable { - services = { - nginx.virtualHosts."${cfg.url}" = { - useACMEHost = pkgs.util.getDomainFromURL cfg.url; - forceSSL = true; - basicAuth = { - "${cfg.auth.user}" = cfg.auth.password; - }; - locations."/" = { - proxyPass = "http://127.0.0.1:9091"; - extraConfig = '' - proxy_pass_header X-Transmission-Session-Id; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - add_header X-Frame-Options SAMEORIGIN; - add_header Front-End-Https on; - ''; - }; - }; - transmission = { - enable = true; - home = cfg.home; - downloadDirPermissions = "770"; # Required. See https://github.com/NixOS/nixpkgs/issues/183429#issuecomment-1648371683 - }; - }; - - systemd.services = { - transmission.unitConfig.RequiresMountsFor = cfg.home; - nginx.wants = [ config.systemd.services.transmission.name ]; - }; - }; -} diff --git a/secrets b/secrets index 967332a..2fc0eb4 160000 --- a/secrets +++ b/secrets @@ -1 +1 @@ -Subproject commit 967332abfd758e3922cb676fd594a220f9b0fa8f +Subproject commit 2fc0eb462b4f2333ac0d9eb9cb2405e05afe66f7