From 38f9902129e5292f9af1a3af57f0489a391d710f Mon Sep 17 00:00:00 2001 From: Reinier Maas Date: Fri, 10 Jul 2026 17:02:23 +0200 Subject: [PATCH] Nix: Skip `cargo check` for `opsqueue` and `opsqueue_python` when building release --- libs/opsqueue_python/opsqueue_python.nix | 2 +- opsqueue/opsqueue.nix | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/opsqueue_python/opsqueue_python.nix b/libs/opsqueue_python/opsqueue_python.nix index 1a35f65..58a9de8 100644 --- a/libs/opsqueue_python/opsqueue_python.nix +++ b/libs/opsqueue_python/opsqueue_python.nix @@ -63,7 +63,7 @@ let cargoExtraArgs = "--package opsqueue_python"; doCheck = false; }; - cargoArtifacts = craneLib.buildDepsOnly (commonArgs // { pname = pname; }); + cargoArtifacts = craneLib.buildDepsOnly (commonArgs // { cargoCheckCommand = "true"; } ); wheelTail = "py3-abi3-linux_x86_64"; wheelName = "opsqueue-${version}-${wheelTail}.whl"; diff --git a/opsqueue/opsqueue.nix b/opsqueue/opsqueue.nix index d9cf77b..4c45c26 100644 --- a/opsqueue/opsqueue.nix +++ b/opsqueue/opsqueue.nix @@ -16,14 +16,17 @@ let sources = import ../nix/sources.nix; crane = import sources.crane { pkgs = pkgs; }; craneLib = crane.overrideToolchain (pkgs: rustToolchain); - extraFileFilter = path: _type: builtins.match "^.*\.(db|sql)$" path != null; - fileFilter = path: type: (extraFileFilter path type) || (craneLib.filterCargoSources path type); + + # Only the files necessary to build the Rust-side and cache dependencies + sqlFileFilter = path: _type: builtins.match "^.*\.(db|sql)$" path != null; + rustCrateFileFilter = + path: type: (sqlFileFilter path type) || (craneLib.filterCargoSources path type); # src = craneLib.cleanCargoSource ../.; src = lib.cleanSourceWith { src = ../.; name = "opsqueue"; - filter = fileFilter; + filter = rustCrateFileFilter; }; crateName = craneLib.crateNameFromCargoToml { cargoToml = ./Cargo.toml; }; @@ -37,7 +40,8 @@ let cargoExtraArgs = "--package opsqueue"; doCheck = true; }; - cargoArtifacts = craneLib.buildDepsOnly commonArgs; + cargoArtifacts = craneLib.buildDepsOnly (commonArgs // { cargoCheckCommand = "true"; } + ); in craneLib.buildPackage ( commonArgs