From 337a0e0755b4952cc09284d72ced8754857f53bc Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Thu, 4 Sep 2025 22:24:29 +0200 Subject: [PATCH] privatebin: Init module --- modules/system/services/privatebin.nix | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 modules/system/services/privatebin.nix diff --git a/modules/system/services/privatebin.nix b/modules/system/services/privatebin.nix new file mode 100644 index 0000000..bc0ffc7 --- /dev/null +++ b/modules/system/services/privatebin.nix @@ -0,0 +1,46 @@ +{ + config, + pkgs-unstable, + lib, + ... +}: +let + cfg = config.custom.services.privatebin; +in +{ + options.custom.services.privatebin = { + enable = lib.mkEnableOption ""; + domain = lib.mkOption { + type = lib.types.nonEmptyStr; + default = ""; + }; + port = lib.mkOption { + type = lib.types.port; + default = 61009; + }; + }; + + config = lib.mkIf cfg.enable { + meta = { + domains.list = [ cfg.domain ]; + ports.tcp.list = [ cfg.port ]; + }; + + services = { + privatebin = { + enable = true; + package = pkgs-unstable.privatebin; # Unstable to get version 2.0 + enableNginx = true; + virtualHost = "privatebin"; + settings.main.basepath = "https://${cfg.domain}"; + }; + + nginx.virtualHosts.privatebin.listen = [ + { + addr = "localhost"; + inherit (cfg) port; + } + ]; + }; + }; +}