-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathflake.nix
More file actions
92 lines (86 loc) · 2.6 KB
/
Copy pathflake.nix
File metadata and controls
92 lines (86 loc) · 2.6 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-darwin"
"aarch64-linux"
#"x86_64-darwin" # missing tools artifact for this system
"x86_64-linux"
];
perSystem =
{
system,
...
}:
let
pkgs = import inputs.nixpkgs {
inherit system;
};
tools = import ./tools/nix pkgs;
cacheUrl = tools.cacheUrl;
tools-artifact = tools.artifacts.${system};
buildInputs = with pkgs; [
cmake
ninja
llvmPackages_18.clang-unwrapped
llvmPackages_18.bintools
ccache
pkg-config
(python312.withPackages (python-pkgs: [
python-pkgs.capstone
python-pkgs.colorama
python-pkgs.cxxfilt
python-pkgs.pyelftools
python-pkgs.watchdog
python-pkgs.levenshtein
python-pkgs.toml
]))
openssl
ncurses5
];
env = {
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
NX_DECOMP_TOOLS_NX2ELF = "${tools-artifact}/bin/nx2elf";
};
in
{
_module.args.pkgs = import inputs.nixpkgs {
config.allowUnfree = true;
};
formatter = pkgs.nixfmt-tree;
devShells.default = pkgs.mkShell (
{
inherit buildInputs;
}
// env
);
packages = {
setup = pkgs.writeShellApplication {
name = "setup";
text = ''
link() {
rm -f "$2"
ln -s "$1" "$2"
}
echo -n "${cacheUrl}" > toolchain/cache-version-url.txt
mkdir -p toolchain/bin
link ${tools-artifact}/bin/clang toolchain/bin/clang
link ${tools-artifact}/bin/ld.lld toolchain/bin/ld.lld
link ${tools-artifact}/bin/decompme tools/decompme
link ${tools-artifact}/bin/check tools/check
link ${tools-artifact}/bin/listsym tools/listsym
SMO_NIX_SETUP=1 python3 tools/setup.py "$@"
'';
runtimeInputs = buildInputs;
runtimeEnv = env;
};
};
};
};
}