about summary refs log tree commit diff
path: root/pkgs/games/gog/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/gog/default.nix')
-rw-r--r--pkgs/games/gog/default.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/games/gog/default.nix b/pkgs/games/gog/default.nix
new file mode 100644
index 00000000..111091c3
--- /dev/null
+++ b/pkgs/games/gog/default.nix
@@ -0,0 +1,39 @@
+{ config, lib, pkgs, ... }:
+
+let
+  cfg = config.gog;
+
+  self = rec {
+    callPackage = pkgs.lib.callPackageWith (pkgs // self);
+    callPackage_i686 = pkgs.lib.callPackageWith (pkgs.pkgsi686Linux // self);
+
+    fetchGog = callPackage ./fetch-gog {
+      inherit (config.gog) email password;
+    };
+  };
+in {
+  options.gog = {
+    email = lib.mkOption {
+      type = lib.types.nullOr lib.types.str;
+      default = null;
+      description = ''
+        Email address for your GOG account.
+      '';
+    };
+
+    password = lib.mkOption {
+      type = lib.types.nullOr lib.types.str;
+      default = null;
+      description = ''
+        Password for your GOG account.
+
+        <note><para>This will end up in the Nix store and other users on the
+        same machine can read it!</para></note>
+      '';
+    };
+  };
+
+  config.packages = {
+    gog = lib.mkIf (cfg.email != null && cfg.password != null) self;
+  };
+}