diff options
author | Qyriad <qyriad@qyriad.me> | 2024-04-06 15:44:27 -0600 |
---|---|---|
committer | jade <lix@jade.fyi> | 2024-04-07 22:44:04 +0000 |
commit | 3ac2dd061302df1625a41b0f0f979ce2504560f0 (patch) | |
tree | 6db594ff8ad926dc8e2ea0f28c84759527af08b3 /package.nix | |
parent | 06e11778b594931b24d256a0a68ccea6533c6b48 (diff) |
package: put boehmgc patch logic in package.nix
In our view it really doesn't make sense to not have this in in
package.nix in some way. These patches aren't just for performance or
something -- Lix flat out doesn't build without these patches.
(Arguably that makes them a buildsystem responsibility as well, but that
can wait for when we're ready to start adding subproject fallback
dependency resolution to Meson.)
This is a step towards making `package.nix` more self-sufficient and
`callPackage`able without excessive external logic.
With this change the following command is enough to build Lix from out
of the flake:
nix-build -E 'let pkgs = import <nixpkgs> { }; in pkgs.callPackage
./package.nix { build-release-notes = false; inherit (pkgs.lib) fileset;
nix-doc = pkgs.callPackage ./nix-doc/package.nix { }; }'
Change-Id: Ia37fe8171f87d3293033de8be07d9bab12716f1d
Diffstat (limited to 'package.nix')
-rw-r--r-- | package.nix | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/package.nix b/package.nix index 6931726ad..8b1fb48ff 100644 --- a/package.nix +++ b/package.nix @@ -5,6 +5,11 @@ autoconf-archive, autoreconfHook, aws-sdk-cpp, + # If the patched version of Boehm isn't passed, then patch it based off of + # pkgs.boehmgc. This allows `callPackage`ing this file without needing to + # to implement behavior that this package flat out doesn't build without + # anyway, but also allows easily overriding the patch logic. + boehmgc-nix ? __forDefaults.boehmgc-nix, boehmgc, nlohmann_json, bison, @@ -63,6 +68,20 @@ # stuff for argument defaults. __forDefaults ? { canRunInstalled = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + boehmgc-nix = (boehmgc.override { + enableLargeConfig = true; + }).overrideAttrs { + patches = [ + # We do *not* include prev.patches (which doesn't exist in normal pkgs.boehmgc anyway) + # because if the caller of this package passed a patched boehm as `boehmgc` instead of + # `boehmgc-nix` then this will almost certainly have duplicate patches, which means + # the patches won't apply and we'll get a build failure. + ./boehmgc-coroutine-sp-fallback.diff + # https://github.com/ivmai/bdwgc/pull/586 + ./boehmgc-traceable_allocator-public.diff + ]; + }; }, }: let inherit (__forDefaults) canRunInstalled; @@ -81,7 +100,7 @@ # The internal API docs need these for the build, but if we're not building # Nix itself, then these don't need to be propagated. maybePropagatedInputs = [ - boehmgc + boehmgc-nix nlohmann_json ]; @@ -324,4 +343,8 @@ in stdenv.mkDerivation (finalAttrs: { passthru.perl-bindings = pkgs.callPackage ./perl { inherit fileset stdenv buildWithMeson; }; + + # Export the patched version of boehmgc. + # flake.nix exports that into its overlay. + passthru.boehmgc-nix = __forDefaults.boehmgc-nix; }) |