zf: patch to fix Zig 0.15.2 compatibility

This commit is contained in:
Jeffrey C. Ollie
2025-10-14 14:00:18 -05:00
parent 1506cdec76
commit be3c55b633
2 changed files with 123 additions and 23 deletions

View File

@@ -1,32 +1,115 @@
# generated by zon2nix (https://github.com/nix-community/zon2nix)
# generated by zon2nix (https://github.com/jcollie/zon2nix)
{
lib,
linkFarm,
fetchzip,
fetchurl,
fetchgit,
runCommandLocal,
zig_0_15,
name ? "zig-packages",
}:
let
unpackZigArtifact =
{
name,
artifact,
}:
runCommandLocal name
{
nativeBuildInputs = [ zig_0_15 ];
}
''
hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})"
mv "$TMPDIR/p/$hash" "$out"
chmod 755 "$out"
'';
linkFarm "zig-packages" [
fetchZig =
{
name,
url,
hash,
}:
let
artifact = fetchurl { inherit url hash; };
in
unpackZigArtifact { inherit name artifact; };
fetchGitZig =
{
name,
url,
hash,
}:
let
parts = lib.splitString "#" url;
url_base = builtins.elemAt parts 0;
url_without_query = builtins.elemAt (lib.splitString "?" url_base) 0;
rev_base = builtins.elemAt parts 1;
rev =
if builtins.match "^[a-fA-F0-9]{40}$" rev_base != null then rev_base else "refs/heads/${rev_base}";
in
fetchgit {
inherit name rev hash;
url = url_without_query;
deepClone = false;
fetchSubmodules = false;
};
fetchZigArtifact =
{
name,
url,
hash,
}:
let
parts = lib.splitString "://" url;
proto = builtins.elemAt parts 0;
path = builtins.elemAt parts 1;
fetcher = {
"git+http" = fetchGitZig {
inherit name hash;
url = "http://${path}";
};
"git+https" = fetchGitZig {
inherit name hash;
url = "https://${path}";
};
http = fetchZig {
inherit name hash;
url = "http://${path}";
};
https = fetchZig {
inherit name hash;
url = "https://${path}";
};
};
in
fetcher.${proto};
in
linkFarm name [
{
name = "vaxis-0.5.1-BWNV_BMgCQDXdZzABeY4F_xwgE7nHFtYEP07KgEwJWo8";
path = fetchgit {
url = "https://github.com/rockorager/libvaxis";
rev = "6eb16bb4190dc074dafaf4f0ce7dadd50e81192a";
hash = "sha256-5c+TjmiH4071lKI+U8SIJ0M+4ezzcAtLI2ZSfZYdXSA=";
name = "uucode-0.1.0-ZZjBPj96QADXyt5sqwBJUnhaDYs_qBeeKijZvlRa0eqM";
path = fetchZigArtifact {
name = "uucode";
url = "git+https://github.com/jacobsandlund/uucode#5f05f8f83a75caea201f12cc8ea32a2d82ea9732";
hash = "sha256-sHPh+TQSdUGus/QTbj7KSJJkTuNTrK4VNmQDjS30Lf8=";
};
}
{
name = "zg-0.15.1-oGqU3M0-tALZCy7boQS86znlBloyKx6--JriGlY0Paa9";
path = fetchzip {
url = "https://codeberg.org/chaten/zg/archive/749197a3f9d25e211615960c02380a3d659b20f9.tar.gz";
hash = "sha256-wzGMfN9Qa3bQRK50p12pdxsSBEVtp2K0gFQFJm7wYMo=";
name = "vaxis-0.5.1-BWNV_LosCQAGmCCNOLljCIw6j6-yt53tji6n6rwJ2BhS";
path = fetchZigArtifact {
name = "vaxis";
url = "https://github.com/rockorager/libvaxis/archive/7dbb9fd3122e4ffad262dd7c151d80d863b68558.tar.gz";
hash = "sha256-LnIzK8icW1Qexua9SHaeHz+3V8QAbz0a+UC1T5sIjvY=";
};
}
{
name = "zigimg-0.1.0-8_eo2vHnEwCIVW34Q14Ec-xUlzIoVg86-7FU2ypPtxms";
path = fetchzip {
path = fetchZigArtifact {
name = "zigimg";
url = "https://github.com/ivanstepanovftw/zigimg/archive/d7b7ab0ba0899643831ef042bd73289510b39906.tar.gz";
hash = "sha256-vkcTloGX+vRw7e6GYJLO9eocYaEOYjXYE0dT7jscZ4A=";
hash = "sha256-LB7Xa6KzVRRUSwwnyWM+y6fDG+kIDjfnoBDJO1obxVM=";
};
}
]

View File

@@ -10,26 +10,36 @@
let
zig = zig_0_15;
zig_hook = zig.hook.overrideAttrs {
zig_default_flags = "-Dcpu=baseline -Doptimize=ReleaseFast --color off";
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "zf";
version = "0.10.3";
upstreamVersion = "0.10.3";
version = "${finalAttrs.upstreamVersion}-unstable-2025-10-14";
rev = "3c52637b7e937c5ae61fd679717da3e276765b23";
src = fetchFromGitHub {
owner = "natecraddock";
repo = "zf";
tag = finalAttrs.version;
hash = "sha256-RHGck3cZx9hzh+z5BexO3k9thda73qSq5ugy0Ouh2QI=";
rev = finalAttrs.rev;
hash = "sha256-BfAZILill3I/nBf1oWwol77N34Jcpm4hudC+XSeMgZY=";
};
nativeBuildInputs = [
installShellFiles
zig.hook
zig_hook
];
postPatch = ''
cp -a ${callPackage ./deps.nix { }}/. $ZIG_GLOBAL_CACHE_DIR/p
'';
deps = callPackage ./deps.nix {
name = "${finalAttrs.pname}-cache-${finalAttrs.version}";
};
zigBuildFlags = [
"--system"
"${finalAttrs.deps}"
];
postInstall = ''
installManPage doc/zf.1
@@ -39,7 +49,14 @@ stdenv.mkDerivation (finalAttrs: {
--zsh complete/_zf
'';
passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
zigCheckFlags = finalAttrs.zigBuildFlags;
doCheck = true;
doInstallCheck = true;
passthru.tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
version = finalAttrs.upstreamVersion;
};
meta = {
homepage = "https://github.com/natecraddock/zf";