Repository navigation
Expand file tree
/
Copy pathshell.nix
More file actions
142 lines (115 loc) · 4.06 KB
/
Copy pathshell.nix
File metadata and controls
142 lines (115 loc) · 4.06 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
# Note that we do a lot of cursed things, so the probability of something breaking is quite high.
#
# This was last tested on:
# - nixpkgs-unstable ~2026-07-01
# - rustc 1.98.0-nightly (4c9d2bfe4 2026-07-01)
{ pkgs ? import <nixpkgs> {} }:
let
aux-normalization = pkgs.callPackage ./normalization/aux-normalization.nix { inherit pkgs; };
metis-normalized = pkgs.callPackage ./metis-normalized.nix { inherit aux-normalization pkgs; };
overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml));
libPath = with pkgs; lib.makeLibraryPath [
aux-normalization
];
testgraphs = pkgs.fetchzip rec {
name = "metis-testgraphs";
version = "1";
url = "https://github.com/gfaster/metis-testgraphs/archive/v${version}.tar.gz";
hash = "sha256-jovqebWIo5QcnuEevqjt2WXZriEQMN1ffvlLBPjQS9k=";
};
gklib = pkgs.stdenv.mkDerivation rec {
pname = "gklib";
version = "dev";
src = pkgs.fetchFromGitHub {
owner = "KarypisLab";
repo = "GKlib";
# from Jul 5 2025
rev = "6e7951358fd896e2abed7887196b6871aac9f2f8";
hash = "sha256-jT0hT5Y3E8GnE8OJWzDj5rtz9s59sMEXLduUnBV0I0Y=";
};
patches = [
./gk_fifo.patch
];
cmakeFlags = [
"-DCMAKE_C_FLAGS_RELEASE=-O2"
"-DASSERT=ON"
];
nativeBuildInputs = with pkgs; [ cmake ];
};
# modified from nixos-26.05
# not overriding because this will stay constant
new_metis = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "metis";
version = "5.2.1";
src = pkgs.fetchFromGitHub {
owner = "KarypisLab";
repo = "METIS";
# From Jul 4 2025
rev = "a6e6a2cfa92f93a3ee2971ebc9ddfc3b0b581ab2";
hash = "sha256-VObeibIQtZ8bFnFo2jXsCh8pqEdVkVOtCBBSvZ4lDEM=";
};
buildInputs = [ gklib ];
nativeBuildInputs = [ pkgs.cmake ];
preConfigure = ''
mkdir -p build/xinclude
echo "#define IDXTYPEWIDTH 32" > build/xinclude/metis.h
echo "#define REALTYPEWIDTH 32" >> build/xinclude/metis.h
cat include/metis.h >> build/xinclude/metis.h
cp include/CMakeLists.txt build/xinclude
'';
dontStrip = true;
cmakeFlags = [
"-DCMAKE_C_FLAGS_RELEASE=-O3"
"-DCMAKE_C_FLAGS=-w"
"-DGKLIB_PATH=${gklib}"
# "-DASSERT=ON"
];
});
in
pkgs.mkShell rec {
name = "metis";
METIS_NORM = metis-normalized;
METIS_NORM_SRC = metis-normalized.src;
METIS_NORM_FUNCTIONS = pkgs.lib.makeLibraryPath [ aux-normalization ];
METIS_TESTGRAPHS_DIR = testgraphs;
buildInputs = with pkgs; [
clang
llvmPackages_latest.bintools
rustup
new_metis
cloc
valgrind
guile
hyperfine
# ocamlPackages.magic-trace
];
RUSTC_VERSION = overrides.toolchain.channel;
# https://github.com/rust-lang/rust-bindgen#environment-variables
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
# See: https://sourceware.org/gdb/current/onlinedocs/gdb.html/File-Options.html
# See: https://nixos.wiki/wiki/Debug_Symbols
shellHook = ''
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
# use our debug helpers
alias norm-gdb="gdb -d ${metis-normalized.src}/programs -d \
${metis-normalized.src}/libmetis -d ${metis-normalized.src}/include -x gdb/options_pp.scm"
'';
LD_LIBRARY_PATH = libPath;
# Add glibc, clang, glib, and other headers to bindgen search path
BINDGEN_EXTRA_CLANG_ARGS =
# Includes normal include path
(builtins.map (a: ''-I"${a}/include"'') [
# add dev libraries here (e.g. pkgs.libvmi.dev)
pkgs.glibc.dev
])
# Includes with special directory paths
++ [
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
''-I"${pkgs.glib.dev}/include/glib-2.0"''
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
];
# needed for dyncall system
# hardeningDisable = ["bindnow"];
hardeningDisable = ["all"];
}