-
Notifications
You must be signed in to change notification settings - Fork 4
/
default.nix
37 lines (32 loc) · 957 Bytes
/
default.nix
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
final: prev: {
# Applies some patches on the nix packages to better cross-compilation support.
mkCrossPkgs =
{ src
, localSystem
, crossSystem ? null
, config ? { }
, overlays ? [ ]
}:
let
localPkgs = import src { inherit localSystem config; };
stdenv = localPkgs.stdenv;
targetIsMusl = crossSystem != null && localPkgs.lib.strings.hasInfix "musl" crossSystem.config;
patchedPkgs = localPkgs.applyPatches {
name = "patched-pkgs";
inherit src;
# Fix musl permissions on Darwin hosts.
patches = [
./patches/gcc-darwin-permissions-fix.patch
];
};
nixpkgs =
if (stdenv.isDarwin && targetIsMusl)
then patchedPkgs
else src;
crossOverlay = import ./.;
in
import nixpkgs {
inherit localSystem crossSystem config;
overlays = [ crossOverlay ] ++ overlays;
};
} // (import ./lib final prev)