Skip to content

Commit 8482a3f

Browse files
committed
feat(nix): add ability to layer patches on-top of the nixpkgs input
This makes unblob be able to use dependent PRs
1 parent c6af67f commit 8482a3f

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

flake.nix

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,36 @@
3636
"aarch64-darwin"
3737
];
3838

39+
# Temporary patches for nixpkgs required for current unblob
40+
nixpkgsPatches = [ ];
41+
3942
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
4043
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
4144

4245
# Nixpkgs instantiated for supported system types.
4346
nixpkgsFor = forAllSystems (
4447
system:
45-
import nixpkgs {
46-
inherit system;
47-
overlays = [
48-
self.overlays.default
49-
];
50-
}
48+
let
49+
importPkgs =
50+
nixpkgs:
51+
import nixpkgs {
52+
inherit system;
53+
overlays = [
54+
self.overlays.default
55+
];
56+
};
57+
58+
bootstrapPkgs = importPkgs nixpkgs;
59+
60+
patchedNixpkgs = bootstrapPkgs.applyPatches {
61+
name = "nixpkgs-patched";
62+
src = nixpkgs;
63+
patches = map bootstrapPkgs.fetchpatch nixpkgsPatches;
64+
};
65+
66+
finalPkgs = importPkgs patchedNixpkgs;
67+
in
68+
if builtins.length nixpkgsPatches != 0 then finalPkgs else bootstrapPkgs
5169
);
5270
in
5371
{

0 commit comments

Comments
 (0)