add transfer.sh module

This commit is contained in:
ulic-youthlic 2025-02-13 13:49:13 +08:00
parent 484965e504
commit adf6aa063c
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
3 changed files with 35 additions and 0 deletions

View file

@ -20,6 +20,7 @@
};
users.deploy.enable = true;
programs = {
transfer-sh.enable = true;
rustypaste = {
enable = true;
url = "https://paste.youthlic.fun";

View file

@ -1,6 +1,7 @@
{ config, lib, ... }:
{
imports = [
./transfer-sh.nix
./rustypaste
./mautrix-telegram.nix
./caddy.nix

View file

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