diff options
Diffstat (limited to 'pkgs/games/cataclysm-dda/lib.nix')
-rw-r--r-- | pkgs/games/cataclysm-dda/lib.nix | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/pkgs/games/cataclysm-dda/lib.nix b/pkgs/games/cataclysm-dda/lib.nix index 02678ed0228..f2b38a16aa5 100644 --- a/pkgs/games/cataclysm-dda/lib.nix +++ b/pkgs/games/cataclysm-dda/lib.nix @@ -1,6 +1,6 @@ { callPackage }: -{ +rec { buildMod = callPackage ./builder.nix { type = "mod"; }; @@ -14,4 +14,33 @@ }; wrapCDDA = callPackage ./wrapper.nix {}; + + # Required to fix `pkgs` and `withMods` attrs after applying `overrideAttrs`. + # + # Example: + # let + # myBuild = cataclysmDDA.jenkins.latest.tiles.overrideAttrs (_: { + # x = "hello"; + # }); + # + # # This refers to the derivation before overriding! So, `badExample.x` is not accessible. + # badExample = myBuild.withMods (_: []); + # + # # `myBuild` is correctly referred by `withMods` and `goodExample.x` is accessible. + # goodExample = let + # inherit (cataclysmDDA) attachPkgs pkgs; + # in + # (attachPkgs pkgs myBuild).withMods (_: []); + # in + # goodExample.x # returns "hello" + attachPkgs = pkgs: super: + let + self = super.overrideAttrs (old: { + passthru = old.passthru // { + pkgs = pkgs.override { build = self; }; + withMods = wrapCDDA self; + }; + }); + in + self; } |