Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
1.9 KiB
Nix
Raw Permalink Normal View History

{
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
cargo,
cargo-tauri_1,
cmake,
jq,
moreutils,
nodejs-slim,
pkg-config,
rustc,
rustPlatform,
yarnConfigHook,
cyrus_sasl,
freetype,
libsoup_2_4,
openssl,
webkitgtk_4_0,
}:
stdenv.mkDerivation rec {
pname = "insulator2";
2024-09-29 23:13:08 +02:00
version = "2.13.2";
src = fetchFromGitHub {
owner = "andrewinci";
treewide: substitute pname for strings Inspired by https://github.com/NixOS/nixpkgs/pull/387725#issuecomment-2704943777, script is based on https://github.com/NixOS/nixpkgs/pull/336172 using what i learned in https://github.com/NixOS/nixpkgs/pull/386865, part of https://github.com/NixOS/nixpkgs/issues/346453 Should be zero rebuilds. All candidates were made using: ```shell export NIXPKGS_ALLOW_UNFREE=1 export NIXPKGS_ALLOW_INSECURE=1 export NIXPKGS_ALLOW_BROKEN=1 git-wait restore . test -s packages.json || ( set -x; time nix-env --extra-experimental-features no-url-literals --option system x86_64-linux -f ./. -qaP --json --meta --drv-path --out-path --show-trace --no-allow-import-from-derivation --arg config '{ allowAliases = false; }' > packages.json ) list_attrpath_fname_col() { jq <packages.json 'to_entries[] | select(.value.meta.position==null|not) | "\(.key)\t\(.value.meta.position)"' -r | sed -e "s#\t$(realpath .)/#\t#" | sed -e 's#:\([0-9]*\)$#\t\1#' | grep . | grep -iv haskell | grep -iv /top-level/ | grep -iv chicken | grep pkgs/by-name/ | grep -iv build | grep -E '/(package|default)\.nix' } FLOCKDIR="$(mktemp -d)" N_WORKERS=4 while read attrpath fname col; do grep -qE 'repo *= *("\$\{pname\}"|pname);' "$fname" || continue echo | ( # mutex on fname flock --nonblock 200 || { >&2 echo "failed to aquire lock for $fname" exit 1 } echo "$attrpath" data="$(nix eval --impure --expr 'with import ./. {}; { inherit ('"$attrpath"') pname drvPath passthru meta; drvPath2='"$attrpath"'.src.drvPath; }' --json)" || exit test -n "$data" || exit pname="$(jq <<<"$data" .pname -r)" test -n "$pname" || exit (set -x sd -F '${pname}' "$pname" "$fname" sd -F ' = pname;' " = \"$pname\";" "$fname" ) data2="$(nix eval --impure --expr 'with import ./. {}; { inherit ('"$attrpath"') pname drvPath passthru meta; drvPath2='"$attrpath"'.src.drvPath; }' --json)" if [[ "$data" = "$data2" ]]; then (set -x; git-wait add "$fname") else (set -x; git-wait restore "$fname") exit fi (set -x sd -F ' rec {' ' {' "$fname" ) data3="$(nix eval --impure --expr 'with import ./. {}; { inherit ('"$attrpath"') pname drvPath passthru meta; drvPath2='"$attrpath"'.src.drvPath; }' --json 2>/dev/nul)" if [[ "$data" = "$data3" ]]; then (set -x; git-wait add "$fname") else (set -x; git-wait restore "$fname") fi ) 200>"$FLOCKDIR"/"$(sha256sum - <<<"$fname" | cut -d' ' -f1)".lock & while [[ $(jobs -p | wc -l) -ge $N_WORKERS ]]; do wait -n < <(jobs -p) || true done done < <(list_attrpath_fname_col) wait git restore . time nix-env --extra-experimental-features no-url-literals --option system x86_64-linux -f ./. -qaP --json --meta --drv-path --out-path --show-trace --no-allow-import-from-derivation --arg config '{ allowAliases = false; }' > packages2.json ``` `diff packages{,2}.json` is empty, indicating that no package nor src derivation has changed. I checked and cherry-picked the changes using `GIT_DIFF_OPTS='-u15' git -c interactive.singleKey=true add --patch`
2025-03-07 01:06:27 +01:00
repo = "insulator2";
rev = "v${version}";
hash = "sha256-34JRIB7/x7miReWOxR/m+atjfUiE3XGyh9OBSbMg3m4=";
};
patches = [
# see: https://github.com/andrewinci/insulator2/pull/733
2024-09-29 23:13:08 +02:00
./fix-rust-1.80.0.patch
];
# Yarn *really* wants us to use corepack if this is set
postPatch = ''
jq 'del(.packageManager)' package.json | sponge package.json
'';
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
2024-09-29 23:13:08 +02:00
hash = "sha256-5wOgVrcHJVF07QpnN52d4VWEM3FKw3NdLrZ1goAP2oI=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
2024-09-29 23:13:08 +02:00
"apache-avro-0.16.0" = "sha256-v4TeJEhLEqQUgj+EHgFRVUGoLC+SpOUhAXngMP7R7nM=";
"rust-keystore-0.1.1" = "sha256-Cj64uJFZNxnrplhRuqf9/HK/RAaawzfYHo/J9snZ+TU=";
};
};
cargoRoot = "backend/";
buildAndTestSubdir = cargoRoot;
strictDeps = true;
dontUseCmakeConfigure = true;
nativeBuildInputs = [
cargo
cargo-tauri_1.hook
cmake
jq
moreutils # for sponge
nodejs-slim
pkg-config
rustc
rustPlatform.cargoSetupHook
yarnConfigHook
];
buildInputs = [
cyrus_sasl
freetype
libsoup_2_4
openssl
webkitgtk_4_0
];
env.OPENSSL_NO_VENDOR = 1;
meta = with lib; {
description = "Client UI to inspect Kafka topics, consume, produce and much more";
homepage = "https://github.com/andrewinci/insulator2";
license = licenses.gpl3Only;
maintainers = with maintainers; [ tc-kaluza ];
2024-02-11 03:19:15 +01:00
mainProgram = "insulator-2";
};
}