blob: 25e29fd9fb07e58310e82e27ed0c6106d13b457e [file] [log] [blame]
Skyler Grey9fe61282023-08-20 21:52:48 +00001{ config, lib, base, ... }:
Skyler Greyfe1740c2023-10-21 01:24:18 +00002lib.recursiveUpdate {
Skyler Grey9fe61282023-08-20 21:52:48 +00003 services.privatebin = {
4 enable = true;
5 settings = {
6 main = {
7 name = "Clicks Minute Paste";
Skyler Grey2ca6ccd2023-10-14 22:56:43 +00008 basepath = "https://privatebin.clicks.codes/";
Skyler Grey9fe61282023-08-20 21:52:48 +00009 opendiscussion = true;
10 fileupload = true;
11
12 defaultformatter = "syntaxhighlighting";
13 syntaxhighlightingtheme = "sons-of-obsidian";
14 template = "bootstrap-dark";
15
Skyler Greyfe1740c2023-10-21 01:24:18 +000016 info = ''
17 Powered by <a href="https://privatebin.info/">PrivateBin</a>. Provided as a service free-of-charge by Clicks. Come chat with us <a href="https://matrix.to/#/#global:coded.codes"> on Matrix</a>'';
18 notice =
19 "This service has no guarantee of uptime, and pastes are not backed up. If you need somewhere to host the last words of your wise old grandfather for time immemorial this is not the place.";
Skyler Grey09c5cda2023-10-09 07:10:10 +000020
Skyler Grey9fe61282023-08-20 21:52:48 +000021 langaugeselection = true;
22 };
23
Skyler Grey2ca6ccd2023-10-14 22:56:43 +000024 nginx = {
25 serverName = "privatebin.clicks.codes";
26 enableACME = true;
27 };
28
Skyler Grey9fe61282023-08-20 21:52:48 +000029 expire.default = "1month";
30
31 expire_options = {
Skyler Greyfe1740c2023-10-21 01:24:18 +000032 "5min" =
33 300; # looks bonkers, but I'm trying to keep the list ordered while also keeping the privatebin label formatter happy
Skyler Grey9fe61282023-08-20 21:52:48 +000034 "10min" = 600;
35 "1hour" = 3600;
36 "1day" = 86400;
37 "1week" = 604800;
38 "1month" = 2592000;
39 };
40
41 formatter_options = {
42 syntaxhighlighting = "Source Code";
43 markdown = "Markdown";
44 plaintext = "Plain Text";
45 };
46
47 traffic = {
Skyler Greyfe1740c2023-10-21 01:24:18 +000048 exempted =
49 "10.0.0.0/8,127.0.0.0/8,169.254.0.0/16,172.16.0.0/12,192.168.0.0/16";
Skyler Grey9fe61282023-08-20 21:52:48 +000050 };
51
52 model.class = "Database";
53 model_options = {
54 dsn = "pgsql:host=localhost;dbname=privatebin";
55 tbl = "privatebin";
56 usr = "privatebin";
57 pwd._env = "PRIVATEBIN_DB_PASSWORD";
58 };
59 };
60 };
Skyler Greyfe1740c2023-10-21 01:24:18 +000061} (if base != null then {
62 services.privatebin.environmentFiles =
63 [ config.scalpel.trafos."privatebin.env".destination ];
Skyler Grey9fe61282023-08-20 21:52:48 +000064
Skyler Greyfe1740c2023-10-21 01:24:18 +000065 scalpel.trafos."privatebin.env" = {
66 source = builtins.toFile "privatebin.env" ''
67 PRIVATEBIN_DB_PASSWORD=!!privatebin_db_password!!
68 '';
69 matchers."privatebin_db_password".secret =
70 config.sops.secrets.clicks_privatebin_db_password.path;
71 owner = config.users.users.privatebin.name;
72 group = config.users.users.privatebin.group;
73 mode = "0400";
74 };
75} else
76 { })