cataclysmDDA: add utility function attachPkgs
This commit is contained in:
parent
19deef39c7
commit
0c02a5599c
@ -33,7 +33,8 @@ let
|
||||
buildMod
|
||||
buildSoundPack
|
||||
buildTileSet
|
||||
wrapCDDA;
|
||||
wrapCDDA
|
||||
attachPkgs;
|
||||
|
||||
inherit pkgs;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA
|
||||
{ lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA, attachPkgs
|
||||
, tiles ? true, Cocoa
|
||||
, debug ? false
|
||||
, useXdgDir ? false
|
||||
@ -26,11 +26,6 @@ let
|
||||
"VERSION=git-${version}-${lib.substring 0 8 src.rev}"
|
||||
];
|
||||
|
||||
passthru = common.passthru // {
|
||||
pkgs = pkgs.override { build = self; };
|
||||
withMods = wrapCDDA self;
|
||||
};
|
||||
|
||||
meta = common.meta // {
|
||||
maintainers = with lib.maintainers;
|
||||
common.meta.maintainers ++ [ rardiol ];
|
||||
@ -38,4 +33,4 @@ let
|
||||
});
|
||||
in
|
||||
|
||||
self
|
||||
attachPkgs pkgs self
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA
|
||||
{ lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA, attachPkgs
|
||||
, tiles ? true, Cocoa
|
||||
, debug ? false
|
||||
, useXdgDir ? false
|
||||
@ -19,11 +19,6 @@ let
|
||||
sha256 = "15l6w6lxays7qmsv0ci2ry53asb9an9dh7l7fc13256k085qcg68";
|
||||
};
|
||||
|
||||
passthru = common.passthru // {
|
||||
pkgs = pkgs.override { build = self; };
|
||||
withMods = wrapCDDA self;
|
||||
};
|
||||
|
||||
meta = common.meta // {
|
||||
maintainers = with lib.maintainers;
|
||||
common.meta.maintainers ++ [ skeidel ];
|
||||
@ -31,4 +26,4 @@ let
|
||||
});
|
||||
in
|
||||
|
||||
self
|
||||
attachPkgs pkgs self
|
||||
|
Loading…
Reference in New Issue
Block a user