|
| 1 | +# generated by zon2nix (https://github.com/Cloudef/zig2nix) |
| 2 | +{ |
| 3 | + lib, |
| 4 | + linkFarm, |
| 5 | + fetchurl, |
| 6 | + fetchgit, |
| 7 | + runCommandLocal, |
| 8 | + zig, |
| 9 | + name ? "zig-packages", |
| 10 | +}: |
| 11 | +let |
| 12 | + unpackZigArtifact = |
| 13 | + { |
| 14 | + name, |
| 15 | + artifact, |
| 16 | + }: |
| 17 | + runCommandLocal name { nativeBuildInputs = [ zig ]; } '' |
| 18 | + hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})" |
| 19 | + mv "$TMPDIR/p/$hash" "$out" |
| 20 | + chmod 755 "$out" |
| 21 | + ''; |
| 22 | + |
| 23 | + fetchZig = |
| 24 | + { |
| 25 | + name, |
| 26 | + url, |
| 27 | + hash, |
| 28 | + }: |
| 29 | + let |
| 30 | + artifact = fetchurl { inherit url hash; }; |
| 31 | + in |
| 32 | + unpackZigArtifact { inherit name artifact; }; |
| 33 | + |
| 34 | + fetchGitZig = |
| 35 | + { |
| 36 | + name, |
| 37 | + url, |
| 38 | + hash, |
| 39 | + }: |
| 40 | + let |
| 41 | + parts = lib.splitString "#" url; |
| 42 | + url_base = builtins.elemAt parts 0; |
| 43 | + url_without_query = builtins.elemAt (lib.splitString "?" url_base) 0; |
| 44 | + rev_base = builtins.elemAt parts 1; |
| 45 | + rev = |
| 46 | + if builtins.match "^[a-fA-F0-9]{40}$" rev_base != null then rev_base else "refs/heads/${rev_base}"; |
| 47 | + in |
| 48 | + fetchgit { |
| 49 | + inherit name rev hash; |
| 50 | + url = url_without_query; |
| 51 | + deepClone = false; |
| 52 | + }; |
| 53 | + |
| 54 | + fetchZigArtifact = |
| 55 | + { |
| 56 | + name, |
| 57 | + url, |
| 58 | + hash, |
| 59 | + }: |
| 60 | + let |
| 61 | + parts = lib.splitString "://" url; |
| 62 | + proto = builtins.elemAt parts 0; |
| 63 | + path = builtins.elemAt parts 1; |
| 64 | + fetcher = { |
| 65 | + "git+http" = fetchGitZig { |
| 66 | + inherit name hash; |
| 67 | + url = "http://${path}"; |
| 68 | + }; |
| 69 | + "git+https" = fetchGitZig { |
| 70 | + inherit name hash; |
| 71 | + url = "https://${path}"; |
| 72 | + }; |
| 73 | + http = fetchZig { |
| 74 | + inherit name hash; |
| 75 | + url = "http://${path}"; |
| 76 | + }; |
| 77 | + https = fetchZig { |
| 78 | + inherit name hash; |
| 79 | + url = "https://${path}"; |
| 80 | + }; |
| 81 | + }; |
| 82 | + in |
| 83 | + fetcher.${proto}; |
| 84 | +in |
| 85 | +linkFarm name [ |
| 86 | + { |
| 87 | + name = "12209db20ce873af176138b76632931def33a10539387cba745db72933c43d274d56"; |
| 88 | + path = fetchZigArtifact { |
| 89 | + name = "zig-pixman"; |
| 90 | + url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz"; |
| 91 | + hash = "sha256-CYgFIOR9H5q8UUpFglaixOocCMT6FGpcKQQBUVWpDKQ="; |
| 92 | + }; |
| 93 | + } |
| 94 | + { |
| 95 | + name = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242"; |
| 96 | + path = fetchZigArtifact { |
| 97 | + name = "zig-wayland"; |
| 98 | + url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz"; |
| 99 | + hash = "sha256-gxzkHLCq2NqX3l4nEly92ARU5dqP1SqnjpGMDgx4TXA="; |
| 100 | + }; |
| 101 | + } |
| 102 | + { |
| 103 | + name = "1220a4029ee3ee70d3175c69878e2b70dccd000c4324bc74ba800d8a143b7250fb38"; |
| 104 | + path = fetchZigArtifact { |
| 105 | + name = "zig-fcft"; |
| 106 | + url = "https://git.sr.ht/~novakane/zig-fcft/archive/1.1.0.tar.gz"; |
| 107 | + hash = "sha256-osL/zsXqa8tC/Qvzf0/wXeNCzw02F2viCo+d8Gh2S7U="; |
| 108 | + }; |
| 109 | + } |
| 110 | +] |
0 commit comments