git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/pinnwand: init
commit8774b9090daa99d111f46551d41eb8f73e9c24e4 authorMartin Weinelt <hexa@darmstadt.ccc.de> dateWed 3 Jun 2020, 21:01 (6 years ago) parent08ba31a
2 files changed+79
nixos/modules/module-list.nix+1 nixos/modules/services/misc/pinnwand.nix+78
nixos/modules/module-list.nix+1
@@ -488,6 +488,7 @@
488488 ./services/misc/parsoid.nix
489489 ./services/misc/plex.nix
490490 ./services/misc/tautulli.nix
491+ ./services/misc/pinnwand.nix
491492 ./services/misc/pykms.nix
492493 ./services/misc/radarr.nix
493494 ./services/misc/redmine.nix
nixos/modules/services/misc/pinnwand.nixnew file+78
@@ -0,0 +1,78 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.pinnwand;
7+
8+ format = pkgs.formats.toml {};
9+ configFile = format.generate "pinnwand.toml" cfg.settings;
10+in
11+{
12+ options.services.pinnwand = {
13+ enable = mkEnableOption "Pinnwand";
14+
15+ port = mkOption {
16+ type = types.port;
17+ description = "The port to listen on.";
18+ default = 8000;
19+ };
20+
21+ settings = mkOption {
22+ type = format.type;
23+ description = ''
24+ Your <filename>pinnwand.toml</filename> as a Nix attribute set. Look up
25+ possible options in the <link xlink:href="https://github.com/supakeen/pinnwand/blob/master/pinnwand.toml-example">pinnwand.toml-example</link>.
26+ '';
27+ default = {
28+ # https://github.com/supakeen/pinnwand/blob/master/pinnwand.toml-example
29+ database_uri = "sqlite:///var/lib/pinnwand/pinnwand.db";
30+ preferred_lexeres = [];
31+ paste_size = 262144;
32+ paste_help = ''
33+ <p>Welcome to pinnwand, this site is a pastebin. It allows you to share code with others. If you write code in the text area below and press the paste button you will be given a link you can share with others so they can view your code as well.</p><p>People with the link can view your pasted code, only you can remove your paste and it expires automatically. Note that anyone could guess the URI to your paste so don't rely on it being private.</p>
34+ '';
35+ footer = ''
36+ View <a href="//github.com/supakeen/pinnwand" target="_BLANK">source code</a>, the <a href="/removal">removal</a> or <a href="/expiry">expiry</a> stories, or read the <a href="/about">about</a> page.
37+ '';
38+ };
39+ };
40+ };
41+
42+ config = mkIf cfg.enable {
43+ systemd.services.pinnwand = {
44+ description = "Pinnwannd HTTP Server";
45+ after = [ "network.target" ];
46+ wantedBy = [ "multi-user.target" ];
47+
48+ unitConfig.Documentation = "https://pinnwand.readthedocs.io/en/latest/";
49+ serviceConfig = {
50+ ExecStart = "${pkgs.pinnwand}/bin/pinnwand --configuration-path ${configFile} http --port ${toString(cfg.port)}";
51+ StateDirectory = "pinnwand";
52+ StateDirectoryMode = "0700";
53+
54+ AmbientCapabilities = [];
55+ CapabilityBoundingSet = "";
56+ DevicePolicy = "closed";
57+ DynamicUser = true;
58+ LockPersonality = true;
59+ MemoryDenyWriteExecute = true;
60+ PrivateDevices = true;
61+ PrivateUsers = true;
62+ ProtectClock = true;
63+ ProtectControlGroups = true;
64+ ProtectKernelLogs = true;
65+ ProtectHome = true;
66+ ProtectHostname = true;
67+ ProtectKernelModules = true;
68+ ProtectKernelTunables = true;
69+ RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
70+ RestrictNamespaces = true;
71+ RestrictRealtime = true;
72+ SystemCallArchitectures = "native";
73+ SystemCallFilter = "@system-service";
74+ UMask = "0077";
75+ };
76+ };
77+ };
78+}