blob: fb95f926ba420c829b57081f7a375d2dcc9d420d (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# nix-build
# or to build a cross compiled package: nix-build -A <triple>.lwjgl
# i.e., nix-build -A aarch64-unknown-linux-gnu.lwjgl
{
pkgs ? import <nixpkgs> {
inherit system;
config = { };
overlays = [ ];
},
nixpkgs ? <nixpkgs>,
system ? builtins.currentSystem,
}:
let
inherit (pkgs) lib;
inherit (pkgs.stdenv.hostPlatform) system;
nativeTarget = pkgs.stdenv.hostPlatform.config;
# Targets we want to build for
targets = [
"x86_64-unknown-linux-gnu"
"i686-unknown-linux-gnu"
"aarch64-unknown-linux-gnu"
"armv7l-unknown-linux-gnueabihf"
"riscv64-unknown-linux-gnu"
];
# Loop over each target
forAllTargets = lib.genAttrs targets;
# Nixpkgs re-instantiated to cross compile from our current system to each target
crossPkgsFor = forAllTargets (
target:
import nixpkgs {
inherit system;
inherit (pkgs) config overlays;
crossSystem = {
config = target;
};
}
);
# Our package set for each target
ourPackagesFor = forAllTargets (
target:
let
callPackage = lib.callPackageWith (ourPackagesFor.${target} // crossPkgsFor.${target});
in
{
fetchAntDeps = callPackage ./pkgs/fetch-ant-deps.nix { };
lwjgl = callPackage ./pkgs/lwjgl.nix { };
}
);
nativeLwjgl =
ourPackagesFor.${nativeTarget}.lwjgl
or (lib.trace "${nativeTarget} is not a supported target" pkgs.emptyFile);
in
ourPackagesFor // { lwjgl = nativeLwjgl; }
|