aboutsummaryrefslogtreecommitdiff
path: root/wapkgs.nix
blob: 2b53dca85d9a571f8d69c7b021d7c9d1aa528eb2 (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
{pkgs ? import <nixpkgs> {}, ...}:

let
  patchSources = src: patches: pkgs.stdenv.mkDerivation {
    name = "${src.name}-patched";
    inherit patches src;
    buildPhase = "mkdir -p $out";
    installPhase = "cp -r * $out";
  };
  sources = {
    tcm = pkgs.fetchFromGitHub {
      owner = "thecodingmachine";
      repo = "workadventure";
      rev = "fb6a529e4ace614c04a41ae794d6087f0ad93d6b";
      sha256 = "10icfzffc7abl6k9lry2nidv75l3lx2f3djpw5mak9ayi05fl5xq";
    };
    xce = pkgs.fetchFromGitHub {
      owner = "workadventure-xce";
      repo = "workadventure-xce";
      rev = "54b3b611554b256abca77fc515a47cfbe4b02df6";
      sha256 = "0ia7054z9jmga7vyh2rzpxl7ssabrzhm9v06d7bhar1vqfbpcx9q";
    };
  };
  wapkgs =
    pkgs.lib.fix (self: let
      mkWorkadventureSet = waSelf: workadventuresrc: name:
        let
          callWaPackage = path: pkgs.lib.callPackageWith
             # some parts of workadventure depend on other parts of workadventure
            (self // { workadventure = waSelf;})
            (import path workadventuresrc name);
        in
          {
            back = callWaPackage ./back {};
            pusher = callWaPackage ./pusher {};
            messages = callWaPackage ./messages {};
            front = callWaPackage ./front {};
            uploader = callWaPackage ./uploader {};
            maps = callWaPackage ./maps {};
          };
    in pkgs // rec {
      tcm = mkWorkadventureSet tcm (patchSources sources.tcm [  ]) "tcm";
      xce = mkWorkadventureSet xce sources.xce "xce";
    });
in {
  workadventure-tcm = wapkgs.tcm;
  workadventure-xce = wapkgs.xce;
}