@@ -0,0 +1,75 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+
7+ cfg = config.services.seeks;
8+
9+ confDir = cfg.confDir;
10+
11+ seeks = pkgs.seeks.override { seeks_confDir = confDir; };
12+
13+in
14+
15+{
16+
17+ ###### interface
18+
19+ options = {
20+
21+ services.seeks = {
22+
23+ enable = mkOption {
24+ default = false;
25+ type = types.bool;
26+ description = "
27+ Whether to enable the Seeks server.
28+ ";
29+ };
30+
31+ confDir = mkOption {
32+ default = "";
33+ type = types.str;
34+ description = "
35+ The Seeks server configuration. If it is not specified,
36+ a default configuration is used (${seeks}/etc/seeks).
37+ ";
38+ };
39+
40+ };
41+
42+ };
43+
44+
45+ ###### implementation
46+
47+ config = mkIf config.services.seeks.enable {
48+
49+ users.extraUsers.seeks =
50+ { uid = config.ids.uids.seeks;
51+ description = "Seeks user";
52+ createHome = true;
53+ home = "/var/lib/seeks";
54+ };
55+
56+ users.extraGroups.seeks =
57+ { gid = config.ids.gids.seeks;
58+ };
59+
60+ systemd.services.seeks =
61+ {
62+ description = "Seeks server, the p2p search engine.";
63+ after = [ "network.target" ];
64+ wantedBy = [ "multi-user.target" ];
65+ serviceConfig = {
66+ User = "seeks";
67+ ExecStart = "${seeks}/bin/seeks";
68+ };
69+ };
70+
71+ environment.systemPackages = [ seeks ];
72+
73+ };
74+
75+}