diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/default.nix | 1 | ||||
-rw-r--r-- | modules/private/websites/tools/tools/default.nix | 16 | ||||
-rw-r--r-- | modules/webapps/fiche.nix | 53 |
3 files changed, 70 insertions, 0 deletions
diff --git a/modules/default.nix b/modules/default.nix index 9ff6ea6..a503f92 100644 --- a/modules/default.nix +++ b/modules/default.nix | |||
@@ -9,6 +9,7 @@ | |||
9 | mastodon = ./webapps/mastodon.nix; | 9 | mastodon = ./webapps/mastodon.nix; |
10 | mediagoblin = ./webapps/mediagoblin.nix; | 10 | mediagoblin = ./webapps/mediagoblin.nix; |
11 | peertube = ./webapps/peertube.nix; | 11 | peertube = ./webapps/peertube.nix; |
12 | fiche = ./webapps/fiche.nix; | ||
12 | 13 | ||
13 | opendmarc = ./opendmarc.nix; | 14 | opendmarc = ./opendmarc.nix; |
14 | openarc = ./openarc.nix; | 15 | openarc = ./openarc.nix; |
diff --git a/modules/private/websites/tools/tools/default.nix b/modules/private/websites/tools/tools/default.nix index 46a28e7..97402f1 100644 --- a/modules/private/websites/tools/tools/default.nix +++ b/modules/private/websites/tools/tools/default.nix | |||
@@ -131,6 +131,15 @@ in { | |||
131 | (ldap.apache.vhostConf pcfg.ldap.socket) | 131 | (ldap.apache.vhostConf pcfg.ldap.socket) |
132 | (kanboard.apache.vhostConf pcfg.kanboard.socket) | 132 | (kanboard.apache.vhostConf pcfg.kanboard.socket) |
133 | (grocy.apache.vhostConf pcfg.grocy.socket) | 133 | (grocy.apache.vhostConf pcfg.grocy.socket) |
134 | '' | ||
135 | Alias /paste /var/lib/fiche | ||
136 | <Directory "/var/lib/fiche"> | ||
137 | DirectoryIndex index.txt index.html | ||
138 | AllowOverride None | ||
139 | Require all granted | ||
140 | Options -Indexes | ||
141 | </Directory> | ||
142 | '' | ||
134 | ]; | 143 | ]; |
135 | }; | 144 | }; |
136 | 145 | ||
@@ -346,6 +355,13 @@ in { | |||
346 | restart = true; | 355 | restart = true; |
347 | paths = [ "/var/secrets/webapps/tools-wallabag" ]; | 356 | paths = [ "/var/secrets/webapps/tools-wallabag" ]; |
348 | }; | 357 | }; |
358 | |||
359 | services.fiche = { | ||
360 | enable = true; | ||
361 | port = config.myEnv.ports.fiche; | ||
362 | domain = "tools.immae.eu/paste"; | ||
363 | https = true; | ||
364 | }; | ||
349 | }; | 365 | }; |
350 | } | 366 | } |
351 | 367 | ||
diff --git a/modules/webapps/fiche.nix b/modules/webapps/fiche.nix new file mode 100644 index 0000000..9061b2e --- /dev/null +++ b/modules/webapps/fiche.nix | |||
@@ -0,0 +1,53 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | cfg = config.services.fiche; | ||
4 | in | ||
5 | { | ||
6 | options.services.fiche = { | ||
7 | enable = lib.mkEnableOption "Enable fiche’s service"; | ||
8 | port = lib.mkOption { | ||
9 | type = lib.types.port; | ||
10 | description = "Port to listen to"; | ||
11 | }; | ||
12 | domain = lib.mkOption { | ||
13 | type = lib.types.str; | ||
14 | description = "Domain"; | ||
15 | }; | ||
16 | dataDir = lib.mkOption { | ||
17 | type = lib.types.path; | ||
18 | default = "/var/lib/fiche"; | ||
19 | description = "Directory where to place the pastes"; | ||
20 | }; | ||
21 | https = lib.mkEnableOption "Use https"; | ||
22 | }; | ||
23 | |||
24 | config = lib.mkIf cfg.enable { | ||
25 | networking.firewall.allowedTCPPorts = [ cfg.port ]; | ||
26 | |||
27 | |||
28 | system.activationScripts.fiche = '' | ||
29 | mkdir -p /var/lib/fiche | ||
30 | ''; | ||
31 | systemd.services.fiche = { | ||
32 | description = "Fiche server"; | ||
33 | wantedBy = [ "multi-user.target" ]; | ||
34 | after = [ "network.target" ]; | ||
35 | |||
36 | script = '' | ||
37 | exec ${pkgs.fiche}/bin/fiche -o ${cfg.dataDir} -d ${cfg.domain} ${lib.optionalString cfg.https "-S "} -p ${builtins.toString cfg.port} | ||
38 | ''; | ||
39 | |||
40 | serviceConfig = { | ||
41 | ExecStartPre = [ | ||
42 | "+${pkgs.coreutils}/bin/install -m 0755 -o fiche -d /var/lib/fiche" | ||
43 | ]; | ||
44 | DynamicUser = true; | ||
45 | User = "fiche"; | ||
46 | PrivateTmp = true; | ||
47 | Restart = "always"; | ||
48 | WorkingDirectory = cfg.dataDir; | ||
49 | ReadWritePaths = cfg.dataDir; | ||
50 | }; | ||
51 | }; | ||
52 | }; | ||
53 | } | ||