about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2013-10-16 11:23:58 -0400
committerShea Levy <shea@shealevy.com>2013-10-16 11:23:58 -0400
commit715bee3a0a4aae345e5e12dc02c307b26297a658 (patch)
tree71e23db58a6d011ca885fd080517fe65fbe8b454 /nixos
parenta5a13c4e437a1c4415741b0c8fb71b85952b33f1 (diff)
downloadnixlib-715bee3a0a4aae345e5e12dc02c307b26297a658.tar
nixlib-715bee3a0a4aae345e5e12dc02c307b26297a658.tar.gz
nixlib-715bee3a0a4aae345e5e12dc02c307b26297a658.tar.bz2
nixlib-715bee3a0a4aae345e5e12dc02c307b26297a658.tar.lz
nixlib-715bee3a0a4aae345e5e12dc02c307b26297a658.tar.xz
nixlib-715bee3a0a4aae345e5e12dc02c307b26297a658.tar.zst
nixlib-715bee3a0a4aae345e5e12dc02c307b26297a658.zip
Add gurobi client module
Not yet tested, no license yet

Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/gurobi.nix41
2 files changed, 42 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 21596ce22697..ff272ffea9b8 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -47,6 +47,7 @@
   ./programs/bash/command-not-found.nix
   ./programs/blcr.nix
   ./programs/environment.nix
+  ./programs/gurobi.nix
   ./programs/info.nix
   ./programs/shadow.nix
   ./programs/shell.nix
diff --git a/nixos/modules/programs/gurobi.nix b/nixos/modules/programs/gurobi.nix
new file mode 100644
index 000000000000..038ead44b4cf
--- /dev/null
+++ b/nixos/modules/programs/gurobi.nix
@@ -0,0 +1,41 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+  cfg = config.programs.gurobi;
+in {
+  options = {
+    programs.gurobi = {
+      license = mkOption {
+        default = null;
+
+        description = "Path to the Gurobi license file if not using a token server";
+
+        type = types.nullOr types.path;
+      };
+
+      tokenServerAddress = mkOption {
+        default = null;
+
+        description = "Address of the token server";
+
+        type = types.nullOr types.string;
+      };
+    };
+
+    config = mkIf (cfg.license != null || cfg.tokenServerAddress != null) {
+      assertions = [ {
+        assertion = cfg.license == null || cfg.tokenServerAddress == null;
+        message = "Please only set one of a gurobi license file and a gurobi token server address";
+      } ];
+
+      environment.variables.GRB_LICENSE_FILE = if cfg.license != null
+        then cfg.license
+        else pkgs.writeTextFile {
+          name = "gurobi-generated-license";
+          text = "TOKENSERVER=${cfg.tokenServerAddress}";
+        };
+    };
+  };
+}