Skip to content

Commit 7c87cd1

Browse files
committed
Use the Dart JIT instead of the AOT compiler
The JIT might be marginally faster
1 parent 8ca7508 commit 7c87cd1

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

day22/derivation.nix

+8-15
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@
33
name = "advent-of-code-2024-day22";
44
src = ./src;
55

6-
nativeBuildInputs = [
6+
buildInputs = [
77
dart
88
];
99

10-
buildPhase = ''
11-
mkdir -p {tmpbin,out}
12-
13-
# Ad-hoc signing is required on arm64 macOS, this fixes it (not sure why
14-
# the dart derivation doesn't provide it)
15-
${if stdenv.isDarwin then ''
16-
ln -s /usr/bin/codesign tmpbin/codesign
17-
'' else ""}
18-
19-
PATH="./tmpbin:$PATH" dart compile exe day22.dart -o out/day22
20-
'';
21-
2210
installPhase = ''
23-
mkdir -p $out/bin
24-
cp out/day22 $out/bin
11+
mkdir -p $out/{bin,share}
12+
cp day22.dart $out/share
13+
14+
cat <<EOF > $out/bin/day22
15+
exec "${dart.outPath}/bin/dart" run "\$(dirname "\$0")/../share/day22.dart" "\$@"
16+
EOF
17+
chmod +x $out/bin/day22
2518
'';
2619
}

0 commit comments

Comments
 (0)