{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"; }; }; 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; }