Skip to content

Commit a79c6b8

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

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

flake.nix

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

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

5469
nativeBuildInputs = with pkgs; [
@@ -57,7 +72,7 @@
5772

5873
buildInputs = with pkgs; [
5974
openssl
60-
xorg.libxcb # Required for xcap screenshot functionality
75+
libxcb # Required for xcap screenshot functionality
6176
dbus # Required for system integration features
6277
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin darwinInputs;
6378

@@ -98,7 +113,7 @@
98113
nodejs_24 # 'just' run-ui
99114
ripgrep
100115
rustfmt
101-
xorg.libxcb
116+
libxcb
102117
dbus
103118
yarn # 'just' install-deps
104119
]);

0 commit comments

Comments
 (0)