blob: f2b38a16aa534a3af63267f881cbb655c2260bd6 (
plain) (
blame)
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
|
{ callPackage }:
rec {
buildMod = callPackage ./builder.nix {
type = "mod";
};
buildSoundPack = callPackage ./builder.nix {
type = "soundpack";
};
buildTileSet = callPackage ./builder.nix {
type = "tileset";
};
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;
}
|