100 lines
2.0 KiB
Nix
100 lines
2.0 KiB
Nix
# generated by zon2nix (https://github.com/Cloudef/zig2nix)
|
|
|
|
{
|
|
lib,
|
|
linkFarm,
|
|
fetchurl,
|
|
fetchgit,
|
|
runCommandLocal,
|
|
zig,
|
|
name ? "zig-packages",
|
|
}:
|
|
|
|
with builtins;
|
|
with lib;
|
|
|
|
let
|
|
unpackZigArtifact =
|
|
{ name, artifact }:
|
|
runCommandLocal name { nativeBuildInputs = [ zig ]; } ''
|
|
hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})"
|
|
mv "$TMPDIR/p/$hash" "$out"
|
|
chmod 755 "$out"
|
|
'';
|
|
|
|
fetchZig =
|
|
{
|
|
name,
|
|
url,
|
|
hash,
|
|
}:
|
|
let
|
|
artifact = fetchurl { inherit url hash; };
|
|
in
|
|
unpackZigArtifact { inherit name artifact; };
|
|
|
|
fetchGitZig =
|
|
{
|
|
name,
|
|
url,
|
|
hash,
|
|
rev ? throw "rev is required, remove and regenerate the zon2json-lock file",
|
|
}:
|
|
let
|
|
parts = splitString "#" url;
|
|
url_base = elemAt parts 0;
|
|
url_without_query = elemAt (splitString "?" url_base) 0;
|
|
in
|
|
fetchgit {
|
|
inherit name rev hash;
|
|
url = url_without_query;
|
|
deepClone = false;
|
|
};
|
|
|
|
fetchZigArtifact =
|
|
{
|
|
name,
|
|
url,
|
|
hash,
|
|
...
|
|
}@args:
|
|
let
|
|
parts = splitString "://" url;
|
|
proto = elemAt parts 0;
|
|
path = elemAt parts 1;
|
|
fetcher = {
|
|
"git+http" = fetchGitZig (
|
|
args
|
|
// {
|
|
url = "http://${path}";
|
|
}
|
|
);
|
|
"git+https" = fetchGitZig (
|
|
args
|
|
// {
|
|
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 = "wayland-0.3.0-lQa1kjPIAQDmhGYpY-zxiRzQJFHQ2VqhJkQLbKKdt5wl";
|
|
path = fetchZigArtifact {
|
|
name = "wayland";
|
|
url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.3.0.tar.gz";
|
|
hash = "sha256-xU8IrETSFOKKQQMgwVyRKLwGaek4USaKXg49S9oHSTQ=";
|
|
};
|
|
}
|
|
]
|