From 73b4b0bfb78998a53b73ce2501f4d2b8bc73198d Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 18 Feb 2018 10:53:38 +0100 Subject: pkgs/games: Add a basic fetcher for GOG We're in almost the same misery here as with HumbleBundle, because we can't get stable download URLs with manifests for games that have an "os" field of either "windows" or "osx". Unfortunately, this isn't the only hoop we're going to, because similar to the HumbleBundle fetcher, we need to solve a (re)captcha in order to login (and I've been annoyed by countless cars, street signs, roads, busses, store fronts, hills and mountains during development). I tried looking for a way to get an API key similar to what itch.io is doing, but the only mechanism in place is a temporary key which needs to be refreshed using the old key after a while, so it's unsuitable for our case. The code currently is very much _not_ DRY, because a lot of it is copied over and modified from fetchHumbleBundle, especially the captcha solving application. It's really a shame to see the same situation that we have for HumbleBundle in GOG, given that HB is getting less DRM-free games these days and GOG is DRM-free *only* (which is a very good thing). Signed-off-by: aszlig --- pkgs/games/gog/default.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pkgs/games/gog/default.nix (limited to 'pkgs/games/gog/default.nix') 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. + + This will end up in the Nix store and other users on the + same machine can read it! + ''; + }; + }; + + config.packages = { + gog = lib.mkIf (cfg.email != null && cfg.password != null) self; + }; +} -- cgit 1.4.1