From cc3d676b47de797192431d5a0c285c4b6d246ce3 Mon Sep 17 00:00:00 2001 From: eljamm Date: Thu, 23 Jan 2025 16:45:19 +0100 Subject: [PATCH] stract: 0-unstable-2024-09-14 -> 0-unstable-2024-12-11 In the previous version, a fixed-output derivation in the source hash was causing another package to be built instead of stract. This commit updates stract to the latest version, fixing the source and the build of the actual package. --- pkgs/by-name/st/stract/package.nix | 47 +++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/st/stract/package.nix b/pkgs/by-name/st/stract/package.nix index ac809562dd9f..d5d583f98f3e 100644 --- a/pkgs/by-name/st/stract/package.nix +++ b/pkgs/by-name/st/stract/package.nix @@ -1,32 +1,63 @@ { lib, + stdenv, fetchFromGitHub, + fetchurl, rustPlatform, pkg-config, + oniguruma, openssl, - curl, + zstd, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage { pname = "stract"; - version = "0-unstable-2024-09-14"; + version = "0-unstable-2024-12-11"; src = fetchFromGitHub { owner = "StractOrg"; repo = "stract"; - rev = "21d28ea86d9ff19ccb4c25b1bdde67e5ec302d79"; - hash = "sha256-7Uvo5+saxwTMQjfDliyOYC6j6LbpMf/FiONfX38xepI="; + rev = "ecb495a66cf6c2f66d817803df38385a3001a38d"; + hash = "sha256-UeIziIihDCjGoz2IdfROnO9/N82S4yextnF4Sbtrn24="; + fetchSubmodules = true; }; - cargoHash = "sha256-7Skbeeev/xBAhlcyOsYpDJB9LnZpT66D0Fu1I/jIBso="; + cargoHash = "sha256-UArPGrcEfFZBOZ4Tv7NraqPzdMtyJXVFsfUM32eSGic="; + useFetchCargoVendor = true; - cargoDepsName = "stract"; nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + oniguruma openssl - curl + zstd ]; + env = { + RUSTONIG_SYSTEM_LIBONIG = true; + ZSTD_SYS_USE_PKG_CONFIG = true; + SWAGGER_UI_DOWNLOAD_URL = + let + # When updating: + # - Look for the version of `utoipa-swagger-ui` at: + # https://github.com/StractOrg/stract/blob//Cargo.toml#L183 + # - Look at the corresponding version of `swagger-ui` at: + # https://github.com/juhaku/utoipa/blob/utoipa-swagger-ui-/utoipa-swagger-ui/build.rs#L21-L22 + swaggerUiVersion = "5.17.12"; + swaggerUi = fetchurl { + url = "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${swaggerUiVersion}.zip"; + hash = "sha256-HK4z/JI+1yq8BTBJveYXv9bpN/sXru7bn/8g5mf2B/I="; + }; + in + "file://${swaggerUi}"; + }; + + # swagger-ui will once more be copied in the target directory during the check phase + # Not deleting the existing unpacked archive leads to a `PermissionDenied` error + preCheck = '' + rm -rf target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/build/ + ''; + meta = { description = "Open source web search engine hosted at stract.com targeted towards tinkerers and developers."; homepage = "https://github.com/StractOrg/stract";