diff options
-rw-r--r-- | modules/default.nix | 1 | ||||
-rw-r--r-- | modules/webapps/fiche.nix | 53 | ||||
-rw-r--r-- | pkgs/default.nix | 2 | ||||
-rw-r--r-- | pkgs/fiche/default.nix | 7 | ||||
-rw-r--r-- | pkgs/fiche/fiche.json | 15 |
5 files changed, 78 insertions, 0 deletions
diff --git a/modules/default.nix b/modules/default.nix index 9ff6ea62..a503f922 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/webapps/fiche.nix b/modules/webapps/fiche.nix new file mode 100644 index 00000000..9061b2ea --- /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 | } | ||
diff --git a/pkgs/default.nix b/pkgs/default.nix index a6630feb..b02c63ec 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix | |||
@@ -75,4 +75,6 @@ rec { | |||
75 | }) {}).monero; | 75 | }) {}).monero; |
76 | 76 | ||
77 | niv = (import sources.niv {}).niv; | 77 | niv = (import sources.niv {}).niv; |
78 | |||
79 | fiche = callPackage ./fiche { inherit mylibs; }; | ||
78 | } | 80 | } |
diff --git a/pkgs/fiche/default.nix b/pkgs/fiche/default.nix new file mode 100644 index 00000000..cc67fb09 --- /dev/null +++ b/pkgs/fiche/default.nix | |||
@@ -0,0 +1,7 @@ | |||
1 | { stdenv, mylibs }: | ||
2 | stdenv.mkDerivation (mylibs.fetchedGithub ./fiche.json // rec { | ||
3 | installPhase = '' | ||
4 | mkdir -p $out/bin | ||
5 | install -m 0755 fiche $out/bin/ | ||
6 | ''; | ||
7 | }) | ||
diff --git a/pkgs/fiche/fiche.json b/pkgs/fiche/fiche.json new file mode 100644 index 00000000..036de7fc --- /dev/null +++ b/pkgs/fiche/fiche.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "tag": "4bba916-master", | ||
3 | "meta": { | ||
4 | "name": "fiche", | ||
5 | "url": "https://github.com/solusipse/fiche", | ||
6 | "branch": "master" | ||
7 | }, | ||
8 | "github": { | ||
9 | "owner": "solusipse", | ||
10 | "repo": "fiche", | ||
11 | "rev": "4bba916e0f4a54d98a3947df7e2d0714d92a8bab", | ||
12 | "sha256": "060pxn8ns2zqszv1dlf7zcaf42avn9svya6irwy5d1ry29hp2ds9", | ||
13 | "fetchSubmodules": true | ||
14 | } | ||
15 | } | ||