summaryrefslogtreecommitdiff
path: root/ymir/factorio.nix
blob: 037b7722365e3feb0b00817596838ac809195a88 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{ config, pkgs, ... }:

let
  modDrv = pkgs.factorio-utils.modDrv {
    allRecommendedMods = true;
    allOptionalMods = false;
  };
  modPortalDrv = { id, name, version, sha256, deps ? [], optionalDeps ? [], recommendedDeps ? [] }: modDrv {
    src = pkgs.fetchurl {
      url = ''https://mods.factorio.com/api/downloads/data/mods/${id}_${version}.zip'';
      inherit sha256;
    };
    inherit deps optionalDeps recommendedDeps;
  };

  availableMods = rec {
    autofill = modPortalDrv {
      id = "354";
      name = "autofill";
      version = "1.4.5";
      sha256 = null;
    };
    EvoGUI = modPortalDrv {
      id = "160";
      name = "EvoGUI";
      version = "0.4.108";
      sha256 = null;
    };
    factorio-reach = modPortalDrv {
      id = "100";
      name = "factorio-reach";
      version = "2.1.1";
      sha256 = null;
    };
    FAIR = modPortalDrv {
      id = "400";
      name = "FAIR";
      version = "0.0.1";
      sha256 = null;
    };
    EvenMoreLight = modPortalDrv {
      id = "551";
      name = "EvenMoreLight";
      version = "0.0.3";
      sha256 = null;
    };
    RailTanker = modPortalDrv {
      id = "45";
      name = "RailTanker";
      version = "1.4.0";
      sha256 = null;
    };
    rso-mod = modPortalDrv {
      id = "34";
      name = "rso-mod";
      version = "2.2.2";
      sha256 = null;
    };
    YARM = modPortalDrv {
      id = "187";
      name = "YARM";
      version = "0.7.106";
      sha256 = null;
    };
  };
in {
  services.factorio = {
    enable = true;
    saveName = config.networking.hostName;
    mods = with availableMods; [
      autofill
      EvoGUI
      factorio-reach
      FAIR
      EvenMoreLight
      RailTanker
      rso-mod
      YARM
    ];
    autosave-interval = 10;
  };

  nixpkgs.config.allowUnfree = true;

  nixpkgs.config.packageOverrides = pkgs: {
    factorio-mkModDirDrv = pkgs.factorio-utils.mkModDirDrv;
  };
}