blob: 17a1556e50885ca8c456fc900b32edc5ac5282d9 [file] [log] [blame]
Skyler Grey9fe61282023-08-20 21:52:48 +00001{ config, lib, base, ... }:
2lib.recursiveUpdate
3{
Skyler Grey9fe61282023-08-20 21:52:48 +00004 services.privatebin = {
5 enable = true;
6 settings = {
7 main = {
8 name = "Clicks Minute Paste";
Skyler Grey2ca6ccd2023-10-14 22:56:43 +00009 basepath = "https://privatebin.clicks.codes/";
Skyler Grey9fe61282023-08-20 21:52:48 +000010 opendiscussion = true;
11 fileupload = true;
12
13 defaultformatter = "syntaxhighlighting";
14 syntaxhighlightingtheme = "sons-of-obsidian";
15 template = "bootstrap-dark";
16
17 info = ''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 = "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 +000019
Skyler Grey9fe61282023-08-20 21:52:48 +000020 langaugeselection = true;
21 };
22
Skyler Grey2ca6ccd2023-10-14 22:56:43 +000023 nginx = {
24 serverName = "privatebin.clicks.codes";
25 enableACME = true;
26 };
27
Skyler Grey9fe61282023-08-20 21:52:48 +000028 expire.default = "1month";
29
30 expire_options = {
31 "5min" = 300; # looks bonkers, but I'm trying to keep the list ordered while also keeping the privatebin label formatter happy
32 "10min" = 600;
33 "1hour" = 3600;
34 "1day" = 86400;
35 "1week" = 604800;
36 "1month" = 2592000;
37 };
38
39 formatter_options = {
40 syntaxhighlighting = "Source Code";
41 markdown = "Markdown";
42 plaintext = "Plain Text";
43 };
44
45 traffic = {
46 exempted = "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";
47 };
48
49 model.class = "Database";
50 model_options = {
51 dsn = "pgsql:host=localhost;dbname=privatebin";
52 tbl = "privatebin";
53 usr = "privatebin";
54 pwd._env = "PRIVATEBIN_DB_PASSWORD";
55 };
56 };
57 };
58}
59(
60 if base != null
61 then {
62 services.privatebin.environmentFiles = [
63 config.scalpel.trafos."privatebin.env".destination
64 ];
65
66 scalpel.trafos."privatebin.env" = {
67 source = builtins.toFile "privatebin.env" ''
68 PRIVATEBIN_DB_PASSWORD=!!privatebin_db_password!!
69 '';
70 matchers."privatebin_db_password".secret =
71 config.sops.secrets.clicks_privatebin_db_password.path;
72 owner = config.users.users.privatebin.name;
73 group = config.users.users.privatebin.group;
74 mode = "0400";
75 };
76 }
77 else {})