
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`
66 lines
1.6 KiB
Nix
66 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
stdenvNoCC,
|
|
fetchFromGitHub,
|
|
fetchpatch,
|
|
makeFontsConf,
|
|
inkscape,
|
|
xcursorgen,
|
|
bc,
|
|
}:
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
pname = "capitaine-cursors";
|
|
version = "4";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "keeferrourke";
|
|
repo = "capitaine-cursors";
|
|
rev = "r${version}";
|
|
sha256 = "0652ydy73x29z7wc6ccyqihmfg4bk0ksl7yryycln6c7i0iqfmc9";
|
|
};
|
|
|
|
patches = [
|
|
# Fixes the build on inscape => 1.0, without this it generates empty cursor files
|
|
(fetchpatch {
|
|
name = "inkscape-1.0-compat";
|
|
url = "https://github.com/keeferrourke/capitaine-cursors/commit/9da0b53e6098ed023c5c24c6ef6bfb1f68a79924.patch";
|
|
sha256 = "0lx5i60ahy6a2pir4zzlqn5lqsv6claqg8mv17l1a028h9aha3cv";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
patchShebangs .
|
|
'';
|
|
|
|
# Complains about not being able to find the fontconfig config file otherwise
|
|
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
|
|
|
|
buildInputs = [
|
|
inkscape
|
|
xcursorgen
|
|
bc
|
|
];
|
|
|
|
buildPhase = ''
|
|
for variant in dark light ; do
|
|
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/data/fonts/emojione/default.nix#L16
|
|
HOME="$NIX_BUILD_ROOT" ./build.sh --max-dpi xhd --type $variant
|
|
done
|
|
'';
|
|
|
|
installPhase = ''
|
|
install -dm 0755 $out/share/icons
|
|
cp -pr dist/dark $out/share/icons/capitaine-cursors
|
|
cp -pr dist/light $out/share/icons/capitaine-cursors-white
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "X-cursor theme inspired by macOS and based on KDE Breeze";
|
|
homepage = "https://github.com/keeferrourke/capitaine-cursors";
|
|
license = licenses.lgpl3;
|
|
platforms = platforms.linux;
|
|
maintainers = with maintainers; [ eadwu ];
|
|
};
|
|
}
|