summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 0f246fdb42f3c1cb2327e10d4e03647f11f1a0bc (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
{
  description = "getchoo's modpack";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    packwiz2nix = {
      url = "github:getchoo/packwiz2nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    nixpkgs,
    packwiz2nix,
    self,
    ...
  }: let
    inherit (nixpkgs) lib;

    systems = [
      "x86_64-linux"
      "aarch64-linux"
      "x86_64-darwin"
      "aarch64-darwin"
    ];

    forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgs.legacyPackages.${s});
  in {
    packages = forAllSystems (pkgs: let
      inherit (pkgs.stdenv.hostPlatform) system;

      inherit
        (packwiz2nix.lib.${system})
        fetchPackwizModpack
        mkMultiMCPack
        ;
    in {
      modpack = fetchPackwizModpack {
        manifest = "${self}/pack.toml";
        hash = "sha256-NVfgazU/mYs8rGBKNBgV+za+T4tmNLDPA8gz0699ZJs=";
      };

      modpack-zip = mkMultiMCPack {
        src = self.packages.${system}.modpack;
        instanceCfg = ./files/instance.cfg;
      };

      default = self.packages.${system}.modpack-zip;
    });

    devShells = forAllSystems (pkgs: {
      default = pkgs.mkShell {
        packages = with pkgs; [
          packwiz
          unzip
          zip
        ];
      };
    });
  };
}