Skip to content

Commit 8c7dc1d

Browse files
committed
fix: flake.nix
Signed-off-by: Tyler Hardin <th020394@gmail.com>
1 parent ab54075 commit 8c7dc1d

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

flake.nix

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,33 @@
3939
++ pkgs.lib.optionals pkgs.stdenv.isDarwin darwinInputs;
4040
in
4141
{
42-
defaultPackage = pkgs.rustPlatform.buildRustPackage {
42+
packages.default = pkgs.rustPlatform.buildRustPackage {
4343
pname = cargoToml.package.name;
4444
version = workspaceToml.workspace.package.version;
4545
src = self;
4646

47-
cargoLock = {
48-
lockFile = ./Cargo.lock;
49-
outputHashes = {
50-
# Patch required for Windows cross-compilation
51-
# See: https://github.com/nmathewson/crunchy/tree/cross-compilation-fix
52-
"crunchy-0.2.3" = "sha256-CBW3/JuMoNa6MWia6BQo07LQrH5JQbb20vuCqhyFL0Y=";
53-
};
47+
cargoLock.lockFile = ./Cargo.lock;
48+
49+
# Pre-fetch rusty_v8 binary to avoid network access during build
50+
# Map Nix system to rusty_v8 target triple
51+
RUSTY_V8_ARCHIVE = let
52+
cargoLock = builtins.fromTOML (builtins.readFile ./Cargo.lock);
53+
rustyV8Version = (builtins.head (builtins.filter (p: p.name == "v8") cargoLock.package)).version;
54+
rustyV8Target = {
55+
"x86_64-linux" = "x86_64-unknown-linux-gnu";
56+
"aarch64-linux" = "aarch64-unknown-linux-gnu";
57+
"x86_64-darwin" = "x86_64-apple-darwin";
58+
"aarch64-darwin" = "aarch64-apple-darwin";
59+
}.${system} or (throw "Unsupported system: ${system}");
60+
rustyV8Sha256 = {
61+
"x86_64-linux" = "sha256-chV1PAx40UH3Ute5k3lLrgfhih39Rm3KqE+mTna6ysE=";
62+
"aarch64-linux" = "sha256-4IivYskhUSsMLZY97+g23UtUYh4p5jk7CzhMbMyqXyY=";
63+
"x86_64-darwin" = "sha256-1jUuC+z7saQfPYILNyRJanD4+zOOhXU2ac/LFoytwho=";
64+
"aarch64-darwin" = "sha256-yHa1eydVCrfYGgrZANbzgmmf25p7ui1VMas2A7BhG6k=";
65+
}.${system};
66+
in pkgs.fetchurl {
67+
url = "https://github.com/denoland/rusty_v8/releases/download/v${rustyV8Version}/librusty_v8_release_${rustyV8Target}.a.gz";
68+
sha256 = rustyV8Sha256;
5469
};
5570

5671
nativeBuildInputs = with pkgs; [
@@ -59,7 +74,7 @@
5974

6075
buildInputs = with pkgs; [
6176
openssl
62-
xorg.libxcb # Required for xcap screenshot functionality
77+
libxcb # Required for xcap screenshot functionality
6378
dbus # Required for system integration features
6479
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin darwinInputs;
6580

@@ -100,7 +115,7 @@
100115
nodejs_24 # 'just' run-ui
101116
ripgrep
102117
rustfmt
103-
xorg.libxcb
118+
libxcb
104119
dbus
105120
yarn # 'just' install-deps
106121
]);

0 commit comments

Comments
 (0)