Add wastebin
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 27m3s

This commit is contained in:
2024-01-10 15:21:40 +00:00
parent f90deabb50
commit 44e87aa387
9 changed files with 2250 additions and 0 deletions

View File

@@ -384,6 +384,10 @@ in
};
useACMEHost = pubDomain;
};
"pb.${pubDomain}" = {
locations."/".proxyPass = "http://object-ctr.${domain}:8088";
useACMEHost = pubDomain;
};
};
minio =

View File

@@ -49,6 +49,7 @@ in
};
"object/atticd.env" = {};
"object/hedgedoc.env" = {};
"object/wastebin.env" = {};
};
};
@@ -58,6 +59,7 @@ in
config.services.sharry.config.bind.port
8069
config.services.hedgedoc.settings.port
8088
];
};
@@ -220,6 +222,15 @@ in
allowEmailRegister = false;
};
};
wastebin = {
enable = true;
settings = {
WASTEBIN_MAX_BODY_SIZE = "67108864"; # 16 MiB
WASTEBIN_PASSWORD_SALT = "TeGhaemeer0Siez3";
};
extraSettingsFile = config.age.secrets."object/wastebin.env".path;
};
};
}
(mkIf config.my.build.isDevVM {

View File

@@ -20,5 +20,6 @@
nvme = ./nvme;
spdk = ./spdk.nix;
librespeed = ./librespeed;
wastebin = ./wastebin.nix;
};
}

View File

@@ -492,6 +492,9 @@ in
}
];
})
(mkIf config.services.wastebin.enable {
my.tmproot.persistence.config.directories = [ "/var/lib/private/wastebin" ];
})
]))
]);

View File

@@ -0,0 +1,35 @@
{ lib, pkgs, config, ... }:
let
inherit (lib) mkIf mkDefault;
inherit (lib.my) mkOpt' mkBoolOpt';
cfg = config.services.wastebin;
in
{
options.services.wastebin = with lib.types; {
enable = mkBoolOpt' false "Whether to enable wastebin.";
package = mkOpt' package pkgs.wastebin "Package to use.";
settings = mkOpt' (attrsOf str) { } "Environment variable settings.";
extraSettingsFile = mkOpt' (nullOr str) null "Extra environment file (e.g. for signing key).";
};
config = mkIf cfg.enable {
services.wastebin.settings = {
WASTEBIN_ADDRESS_PORT = mkDefault "[::]:8088";
WASTEBIN_DATABASE_PATH = mkDefault "/var/lib/wastebin/db.sqlite3";
};
systemd.services.wastebin = {
description = "wastebin minimal pastebin";
after = [ "network.target" ];
environment = cfg.settings;
serviceConfig = {
EnvironmentFile = mkIf (cfg.extraSettingsFile != null) cfg.extraSettingsFile;
DynamicUser = true;
StateDirectory = "wastebin";
ExecStart = "${cfg.package}/bin/wastebin";
};
wantedBy = [ "multi-user.target" ];
};
};
}