From a5a13c4e437a1c4415741b0c8fb71b85952b33f1 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 16 Oct 2013 10:58:32 -0400 Subject: [PATCH] Add gurobi token server service Not yet tested, I don't have a license yet Signed-off-by: Shea Levy --- nixos/modules/module-list.nix | 1 + nixos/modules/services/misc/gurobi.nix | 41 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 nixos/modules/services/misc/gurobi.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b835907c82f..21596ce2269 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -35,6 +35,7 @@ ./misc/assertions.nix ./misc/check-config.nix ./misc/crashdump.nix + ./misc/gurobi.nix ./misc/ids.nix ./misc/lib.nix ./misc/locate.nix diff --git a/nixos/modules/services/misc/gurobi.nix b/nixos/modules/services/misc/gurobi.nix new file mode 100644 index 00000000000..9cd76a1e78f --- /dev/null +++ b/nixos/modules/services/misc/gurobi.nix @@ -0,0 +1,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"; + }; + }; + }; +}