{pkgs ? import {}, ...}: 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"; }; xce-unfederated = pkgs.fetchFromGitHub { owner = "workadventure-xce"; repo = "workadventure-xce"; rev = "f0c26041f814a6c78679f1cdf555c0c4af87d8a3"; sha256 = "13b4sd49yp9pyqpmlsh7w2sbns0nc9k13l5z94kbj8bcaslnwjx4"; }; }; 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 sources.tcm "tcm"; xce = mkWorkadventureSet xce sources.xce "xce"; xce-unfederated = mkWorkadventureSet xce-unfederated (patchSources sources.xce-unfederated [./xce-unfederated.patch]) "xce-unfederated"; }); in { workadventure-tcm = wapkgs.tcm; workadventure-xce = wapkgs.xce; workadventure-xce-unfederated = wapkgs.xce-unfederated; }