1
0
Fork 0

Services: cleanup

This commit is contained in:
Aires 2024-09-10 20:59:00 -04:00
parent b908977f9a
commit 8bcbcb5768
5 changed files with 5 additions and 152 deletions

View file

@ -378,11 +378,11 @@
"secrets": { "secrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1726013710, "lastModified": 1726016318,
"narHash": "sha256-0xzIUXzp3P5sUVB2XLmtxXoxleqHdSw9j/hpbcOCpRg=", "narHash": "sha256-0pvkDJhDPRY0TkeJ4Wh4tjliPA+q+DZZZmBMRsUHvMw=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "967332abfd758e3922cb676fd594a220f9b0fa8f", "rev": "2fc0eb462b4f2333ac0d9eb9cb2405e05afe66f7",
"revCount": 73, "revCount": 74,
"type": "git", "type": "git",
"url": "file:./secrets" "url": "file:./secrets"
}, },

View file

@ -120,11 +120,6 @@ in
user = config.users.users.aires.name; user = config.users.users.aires.name;
}; };
boinc.enable = true; boinc.enable = true;
deluge = {
enable = true;
home = "${services-root}/deluge";
url = config.secrets.services.deluge.url;
};
duplicacy-web = { duplicacy-web = {
enable = true; enable = true;
home = "/storage/backups/settings/Haven"; home = "/storage/backups/settings/Haven";
@ -195,15 +190,6 @@ in
enable = true; enable = true;
ports = [ config.secrets.hosts.dimaga.ssh.port ]; 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 = { virtualization.host = {
enable = true; enable = true;
user = "aires"; user = "aires";

View file

@ -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 ];
};
};
}

View file

@ -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 ];
};
};
}

@ -1 +1 @@
Subproject commit 967332abfd758e3922cb676fd594a220f9b0fa8f Subproject commit 2fc0eb462b4f2333ac0d9eb9cb2405e05afe66f7