blob: eece255df736313db1b5607acf3f57baef85becd [file] [log] [blame]
Skyler Grey9fe61282023-08-20 21:52:48 +00001{ config, lib, base, ... }:
Skyler Greyfe1740c2023-10-21 01:24:18 +00002lib.recursiveUpdate {
Skyler Grey4259e932023-10-21 21:37:03 +00003 services.nginx.virtualHosts.privatebin = {
4 serverName = lib.mkForce "privatebin.clicks.codes";
5 enableACME = lib.mkForce true;
6 forceSSL = lib.mkForce true;
7 };
Skyler Grey9fe61282023-08-20 21:52:48 +00008 services.privatebin = {
9 enable = true;
10 settings = {
11 main = {
12 name = "Clicks Minute Paste";
Skyler Grey2ca6ccd2023-10-14 22:56:43 +000013 basepath = "https://privatebin.clicks.codes/";
Skyler Grey9fe61282023-08-20 21:52:48 +000014 opendiscussion = true;
15 fileupload = true;
16
17 defaultformatter = "syntaxhighlighting";
18 syntaxhighlightingtheme = "sons-of-obsidian";
19 template = "bootstrap-dark";
20
Skyler Greyfe1740c2023-10-21 01:24:18 +000021 info = ''
22 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>'';
23 notice =
24 "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 +000025
Skyler Grey9fe61282023-08-20 21:52:48 +000026 langaugeselection = true;
27 };
28
Skyler Grey9fe61282023-08-20 21:52:48 +000029 expire.default = "1month";
30
Skyler Grey4259e932023-10-21 21:37:03 +000031 nginx.forceSSL = lib.mkForce true;
32
Skyler Grey9fe61282023-08-20 21:52:48 +000033 expire_options = {
Samuel Shuertf68685d2023-10-28 20:07:56 -040034 "5min" = 300;
Skyler Grey9fe61282023-08-20 21:52:48 +000035 "10min" = 600;
36 "1hour" = 3600;
37 "1day" = 86400;
38 "1week" = 604800;
39 "1month" = 2592000;
40 };
41
42 formatter_options = {
43 syntaxhighlighting = "Source Code";
44 markdown = "Markdown";
45 plaintext = "Plain Text";
46 };
47
48 traffic = {
Skyler Greyfe1740c2023-10-21 01:24:18 +000049 exempted =
50 "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 +000051 };
52
53 model.class = "Database";
54 model_options = {
55 dsn = "pgsql:host=localhost;dbname=privatebin";
56 tbl = "privatebin";
57 usr = "privatebin";
58 pwd._env = "PRIVATEBIN_DB_PASSWORD";
59 };
60 };
61 };
Skyler Greyfe1740c2023-10-21 01:24:18 +000062} (if base != null then {
63 services.privatebin.environmentFiles =
64 [ config.scalpel.trafos."privatebin.env".destination ];
Skyler Grey9fe61282023-08-20 21:52:48 +000065
Skyler Greyfe1740c2023-10-21 01:24:18 +000066 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} else
77 { })