-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathflake.nix
More file actions
executable file
·157 lines (144 loc) · 4.04 KB
/
flake.nix
File metadata and controls
executable file
·157 lines (144 loc) · 4.04 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
flake-utils,
nixpkgs,
...
}:
let
mkDevkit =
pkgs:
{
name,
src,
includePaths ? [ ],
}:
pkgs.stdenv.mkDerivation (finalAttrs: {
inherit name;
src = pkgs.dockerTools.pullImage (pkgs.lib.importJSON src);
nativeBuildInputs = with pkgs; [
autoPatchelfHook
];
buildInputs = with pkgs; [
ncurses
stdenv.cc.cc.lib
];
dontPatchShebangs = true;
phases = [
"buildPhase"
"fixupPhase"
];
buildPhase = ''
tar -xf $src
for archive in $(find *.tar)
do
tar -xf $archive
done
mkdir -p $out
cp -r opt $out/opt
ln -sf $out/opt/devkitpro/tools/bin $out/bin
rm $out/opt/devkitpro/pacman/share/pacman/keyrings
'';
passthru = rec {
CPATH = pkgs.lib.makeSearchPath "include" (
builtins.map (x: "${finalAttrs.finalPackage}/opt/devkitpro/${x}") includePaths
);
shellHook = pkgs.lib.warn "shellHook is deprecated, please consider using devkitNix stdenv packages instead (see README)" ''
export DEVKITPRO="${finalAttrs.finalPackage}/opt/devkitpro"
export DEVKITARM="$DEVKITPRO/devkitARM"
export DEVKITPPC="$DEVKITPRO/devkitPPC"
export CPATH=${CPATH}
export PATH="${
pkgs.lib.makeBinPath [
"$DEVKITPRO"
"$DEVKITARM"
"$DEVKITPPC"
]
}:$PATH"
'';
};
});
packages = pkgs: rec {
devkitA64 = mkDevkit pkgs {
name = "devkitA64";
src = ./sources/devkita64.json;
includePaths = [
"devkitA64"
"devkitA64/aarch64-none-elf"
"libnx"
"portlibs/switch"
];
};
devkitARM = mkDevkit pkgs {
name = "devkitARM";
src = ./sources/devkitarm.json;
includePaths = [
"devkitARM"
"devkitARM/arm-none-eabi"
"libctru"
"libgba"
"libmirko"
"libnds"
"liborcus"
"libtonc"
"portlibs/3ds"
"portlibs/armv4t"
"portlibs/gba"
"portlibs/gp2x"
"portlibs/nds"
];
};
devkitPPC = mkDevkit pkgs {
name = "devkitPPC";
src = ./sources/devkitppc.json;
includePaths = [
"devkitPPC"
"devkitPPC/powerpc-eabi"
"libogc"
"portlibs/gamecube"
"portlibs/ppc"
"portlibs/wii"
"portlibs/wiiu"
"wut"
];
};
stdenvA64 = pkgs.stdenvAdapters.addAttrsToDerivation {
nativeBuildInputs = [ devkitA64 ];
env.DEVKITPRO = devkitA64 + "/opt/devkitpro";
} pkgs.stdenvNoCC;
stdenvARM = pkgs.stdenvAdapters.addAttrsToDerivation {
nativeBuildInputs = [ devkitARM ];
env = rec {
DEVKITPRO = devkitARM + "/opt/devkitpro";
DEVKITARM = DEVKITPRO + "/devkitARM";
};
} pkgs.stdenvNoCC;
stdenvPPC = pkgs.stdenvAdapters.addAttrsToDerivation {
nativeBuildInputs = [ devkitPPC ];
env = rec {
DEVKITPRO = devkitPPC + "/opt/devkitpro";
DEVKITPPC = DEVKITPRO + "/devkitPPC";
};
} pkgs.stdenvNoCC;
};
in
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs' = nixpkgs.legacyPackages.${system};
in
{
packages = packages pkgs';
}
))
// {
overlays.default = final: prev: {
devkitNix = packages prev;
};
};
}