summary refs log tree commit diff
path: root/nixos/modules/services/misc/gurobi.nix
blob: 9cd76a1e78f745674a9579e11edd5488f79cb45d (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
{ config, pkgs, ... }:

with pkgs.lib;

let
  cfg = config.services.gurobi.tokenServer;
in {
  options = {
    services.gurobi.tokenServer = {
      enable = mkOption {
        default = false;

        description = "Whether to enable the Gurobi token server";

        type = types.bool;
      };

      license = mkOption {
        description = "Path to the Gurobi license file";

        type = types.path;
      };
    };
  };

  config = mkIf cfg.enable {
    systemd.services.gurobi-token-server = {
      description = "Gurobi token server";

      wantedBy = [ "multi-user.target" ];

      environment.GRB_LICENSE_FILE = cfg.license;

      serviceConfig = {
        ExecStart = "${pkgs.gurobi}/bin/grb_ts";

        Type = "forking";
      };
    };
  };
}