Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 47 lines 1.2 kB view raw
1{ callPackage }: 2 3rec { 4 buildMod = callPackage ./builder.nix { 5 type = "mod"; 6 }; 7 8 buildSoundPack = callPackage ./builder.nix { 9 type = "soundpack"; 10 }; 11 12 buildTileSet = callPackage ./builder.nix { 13 type = "tileset"; 14 }; 15 16 wrapCDDA = callPackage ./wrapper.nix { }; 17 18 # Required to fix `pkgs` and `withMods` attrs after applying `overrideAttrs`. 19 # 20 # Example: 21 # let 22 # myBuild = cataclysmDDA.jenkins.latest.tiles.overrideAttrs (_: { 23 # x = "hello"; 24 # }); 25 # 26 # # This refers to the derivation before overriding! So, `badExample.x` is not accessible. 27 # badExample = myBuild.withMods (_: []); 28 # 29 # # `myBuild` is correctly referred by `withMods` and `goodExample.x` is accessible. 30 # goodExample = let 31 # inherit (cataclysmDDA) attachPkgs pkgs; 32 # in 33 # (attachPkgs pkgs myBuild).withMods (_: []); 34 # in 35 # goodExample.x # returns "hello" 36 attachPkgs = 37 pkgs: super: 38 let 39 self = super.overrideAttrs (old: { 40 passthru = old.passthru // { 41 pkgs = pkgs.override { build = self; }; 42 withMods = wrapCDDA self; 43 }; 44 }); 45 in 46 self; 47}