diff --git a/nixos/configurations/Cape/default.nix b/nixos/configurations/Cape/default.nix index 20a8c50..f91dba4 100644 --- a/nixos/configurations/Cape/default.nix +++ b/nixos/configurations/Cape/default.nix @@ -20,6 +20,7 @@ }; users.deploy.enable = true; programs = { + transfer-sh.enable = true; rustypaste = { enable = true; url = "https://paste.youthlic.fun"; diff --git a/nixos/modules/programs/default.nix b/nixos/modules/programs/default.nix index 0356117..98433b2 100644 --- a/nixos/modules/programs/default.nix +++ b/nixos/modules/programs/default.nix @@ -1,6 +1,7 @@ { config, lib, ... }: { imports = [ + ./transfer-sh.nix ./rustypaste ./mautrix-telegram.nix ./caddy.nix diff --git a/nixos/modules/programs/transfer-sh.nix b/nixos/modules/programs/transfer-sh.nix new file mode 100644 index 0000000..a861fe3 --- /dev/null +++ b/nixos/modules/programs/transfer-sh.nix @@ -0,0 +1,33 @@ +{ lib, config, ... }: +let + cfg = config.youthlic.programs.transfer-sh; +in +{ + options = { + youthlic.programs.transfer-sh = { + enable = lib.mkEnableOption "transfer.sh"; + }; + }; + config = lib.mkMerge [ + (lib.mkIf cfg.enable { + services.transfer-sh = { + enable = true; + provider = "local"; + settings = { + BASEDIR = "/var/lib/transfer.sh"; + LISTENER = ":8484"; + TLS_LISTENER_ONLY = false; + }; + }; + }) + (lib.mkIf (cfg.enable && config.youthlic.programs.caddy.enable) { + services.caddy.virtualHosts = { + "transfer.${config.youthlic.programs.caddy.baseDomain}" = { + extraConfig = '' + reverse_proxy 127.0.0.1:8484 + ''; + }; + }; + }) + ]; +}