Skyler Grey | 9fe6128 | 2023-08-20 21:52:48 +0000 | [diff] [blame] | 1 | { config, lib, base, ... }: |
| 2 | lib.recursiveUpdate |
| 3 | { |
Skyler Grey | 9fe6128 | 2023-08-20 21:52:48 +0000 | [diff] [blame] | 4 | services.privatebin = { |
| 5 | enable = true; |
| 6 | settings = { |
| 7 | main = { |
| 8 | name = "Clicks Minute Paste"; |
| 9 | basepath = "https://paste.clicks.codes/"; |
| 10 | 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 Grey | 09c5cda | 2023-10-09 07:10:10 +0000 | [diff] [blame^] | 19 | |
Skyler Grey | 9fe6128 | 2023-08-20 21:52:48 +0000 | [diff] [blame] | 20 | langaugeselection = true; |
| 21 | }; |
| 22 | |
| 23 | expire.default = "1month"; |
| 24 | |
| 25 | expire_options = { |
| 26 | "5min" = 300; # looks bonkers, but I'm trying to keep the list ordered while also keeping the privatebin label formatter happy |
| 27 | "10min" = 600; |
| 28 | "1hour" = 3600; |
| 29 | "1day" = 86400; |
| 30 | "1week" = 604800; |
| 31 | "1month" = 2592000; |
| 32 | }; |
| 33 | |
| 34 | formatter_options = { |
| 35 | syntaxhighlighting = "Source Code"; |
| 36 | markdown = "Markdown"; |
| 37 | plaintext = "Plain Text"; |
| 38 | }; |
| 39 | |
| 40 | traffic = { |
| 41 | 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"; |
| 42 | }; |
| 43 | |
| 44 | model.class = "Database"; |
| 45 | model_options = { |
| 46 | dsn = "pgsql:host=localhost;dbname=privatebin"; |
| 47 | tbl = "privatebin"; |
| 48 | usr = "privatebin"; |
| 49 | pwd._env = "PRIVATEBIN_DB_PASSWORD"; |
| 50 | }; |
| 51 | }; |
| 52 | }; |
| 53 | } |
| 54 | ( |
| 55 | if base != null |
| 56 | then { |
| 57 | services.privatebin.environmentFiles = [ |
| 58 | config.scalpel.trafos."privatebin.env".destination |
| 59 | ]; |
| 60 | |
| 61 | scalpel.trafos."privatebin.env" = { |
| 62 | source = builtins.toFile "privatebin.env" '' |
| 63 | PRIVATEBIN_DB_PASSWORD=!!privatebin_db_password!! |
| 64 | ''; |
| 65 | matchers."privatebin_db_password".secret = |
| 66 | config.sops.secrets.clicks_privatebin_db_password.path; |
| 67 | owner = config.users.users.privatebin.name; |
| 68 | group = config.users.users.privatebin.group; |
| 69 | mode = "0400"; |
| 70 | }; |
| 71 | } |
| 72 | else {}) |