summary refs log tree commit diff
path: root/nixos/modules/services/networking/seeks.nix
blob: 40729225b6d0a37d54306e711b845c3909ca8d19 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.services.seeks;

  confDir = cfg.confDir;

  seeks = pkgs.seeks.override { seeks_confDir = confDir; };

in

{

  ###### interface

  options = {

    services.seeks = {

      enable = mkOption {
        default = false;
        type = types.bool;
        description = "
          Whether to enable the Seeks server.
        ";
      };

      confDir = mkOption {
        default = "";
        type = types.str;
        description = "
          The Seeks server configuration. If it is not specified,
          a default configuration is used.
        ";
      };

    };

  };


  ###### implementation

  config = mkIf config.services.seeks.enable {

    users.users.seeks =
      { uid = config.ids.uids.seeks;
        description = "Seeks user";
        createHome = true;
        home = "/var/lib/seeks";
      };

    users.groups.seeks =
      { gid = config.ids.gids.seeks;
      };

    systemd.services.seeks =
      {
        description = "Seeks server, the p2p search engine.";
        after = [ "network.target" ];
        wantedBy = [ "multi-user.target" ];
        serviceConfig = {
          User = "seeks";
          ExecStart = "${seeks}/bin/seeks";
        };
      };

    environment.systemPackages = [ seeks ];

  };

}