about summary refs log tree commit diff
path: root/default.nix
blob: 80420a8b5f61ce0e948b13b3ee8f43f8e3b11ca8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ configuration ? null }:

let
  configFilePath = let
    xdgConfig = builtins.getEnv "XDG_CONFIG_HOME";
    fallback = "${builtins.getEnv "HOME"}/.config";
    basedir = if xdgConfig == "" then fallback else xdgConfig;
  in "${basedir}/nixgames.nix";

  configFile = if !builtins.pathExists configFilePath then throw ''
    The config file "${configFilePath}" doesn't exist! Be sure to create it and
    put your HumbleBundle email address and password in it, like this:

    {
      humblebundle.email = "fancyuser@example.com";
      humblebundle.password = "my_super_secret_password";
    }
  '' else configFilePath;

in ((import <nixpkgs/lib>).evalModules {
  modules = [
    (if configuration == null then configFilePath else configuration)
    ./base-module.nix ./humblebundle
  ];
}).config.packages