about summary refs log tree commit diff
path: root/humblebundle/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'humblebundle/default.nix')
-rw-r--r--humblebundle/default.nix32
1 files changed, 27 insertions, 5 deletions
diff --git a/humblebundle/default.nix b/humblebundle/default.nix
index 6e733603..953f3481 100644
--- a/humblebundle/default.nix
+++ b/humblebundle/default.nix
@@ -1,13 +1,13 @@
-{ email ? null, password ? null }:
-
-with import <nixpkgs> {};
+{ config, lib, pkgs, ... }:
 
 let
+  cfg = config.humblebundle;
+
   self = rec {
     callPackage = pkgs.lib.callPackageWith (pkgs // self);
 
     fetchHumbleBundle = callPackage ./fetch-humble-bundle {
-      inherit email password;
+      inherit (config.humblebundle) email password;
     };
 
     bastion = callPackage ./bastion.nix {};
@@ -21,4 +21,26 @@ let
     spaz = callPackage ./spaz.nix {};
     swordsandsoldiers = callPackage ./swordsandsoldiers.nix {};
   };
-in self
+in with lib; {
+  options.humblebundle = {
+    email = mkOption {
+      type = types.nullOr types.str;
+      default = null;
+      description = ''
+        Email address for your HumbleBundle account.
+      '';
+    };
+
+    password = mkOption {
+      type = types.nullOr types.str;
+      default = null;
+      description = ''
+        Password for your HumbleBundle account.
+      '';
+    };
+  };
+
+  config.packages = {
+    humblebundle = mkIf (cfg.email != null && cfg.password != null) self;
+  };
+}