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`
95 lines
1.9 KiB
Nix
95 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitLab,
|
|
fetchpatch,
|
|
cmake,
|
|
installShellFiles,
|
|
bison,
|
|
boost,
|
|
flex,
|
|
gmp,
|
|
libxml2,
|
|
mpfi,
|
|
mpfr,
|
|
scalp,
|
|
sollya,
|
|
wcpg,
|
|
}:
|
|
|
|
stdenv.mkDerivation {
|
|
pname = "flopoco";
|
|
version = "4.1.3";
|
|
|
|
src = fetchFromGitLab {
|
|
owner = "flopoco";
|
|
repo = "flopoco";
|
|
# flopoco-4.1.3 is not tagged on GitLab
|
|
rev = "67598298207c9f3261c35679c8a5966480c4343c";
|
|
hash = "sha256-0jRjg4/qciqBcjsi6BTbKO4VJkcoEzpC98wFkUOIGbI=";
|
|
};
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
name = "fix-clang-error-sin-cos.patch";
|
|
url = "https://gitlab.com/flopoco/flopoco/-/commit/de3aa60ad19333952c176c2a2e51f12653ca736b.patch";
|
|
postFetch = ''
|
|
substituteInPlace $out \
|
|
--replace 'FixSinCosCORDIC.hpp' 'CordicSinCos.hpp'
|
|
'';
|
|
sha256 = "sha256-BlamA/MZuuqqvGYto+jPeQPop6gwva0y394Odw8pdwg=";
|
|
})
|
|
(fetchpatch {
|
|
name = "fix-clang-error-atan2.patch";
|
|
url = "https://gitlab.com/flopoco/flopoco/-/commit/a3ffe2436c1b59ee0809b3772b74f2d43c6edb99.patch";
|
|
sha256 = "sha256-dSYcufLHDL0p1V1ghmy6X6xse5f6mjUqckaVqLZnTaA=";
|
|
})
|
|
];
|
|
|
|
postPatch = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
|
|
sed -i "s/-pg//g" {,src/Apps/TaMaDi/}CMakeLists.txt
|
|
'';
|
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [
|
|
bison
|
|
cmake
|
|
flex
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs = [
|
|
boost
|
|
gmp
|
|
libxml2
|
|
mpfi
|
|
mpfr
|
|
scalp
|
|
sollya
|
|
wcpg
|
|
];
|
|
|
|
postBuild = ''
|
|
./flopoco BuildAutocomplete
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -Dm755 flopoco $out/bin/flopoco
|
|
cp bin* fp* ieee* longacc* $out/bin/
|
|
installShellCompletion --bash flopoco_autocomplete
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "FloPoCo arithmetic core generator";
|
|
homepage = "https://flopoco.org/";
|
|
license = licenses.unfree;
|
|
platforms = platforms.unix;
|
|
maintainers = with maintainers; [ wegank ];
|
|
};
|
|
}
|