build-bazel-package: added rm of extra local folders for toolchain configuration...
[NixPkgs.git] / pkgs / by-name / wa / waylock / build.zig.zon.nix
blob75cb2579adf1c193a266b09c564381bc45034298
1 # generated by zon2nix (https://github.com/Cloudef/zig2nix)
4   lib,
5   linkFarm,
6   fetchurl,
7   fetchgit,
8   runCommandLocal,
9   zig,
10   name ? "zig-packages",
13 with builtins;
14 with lib;
16 let
17   unpackZigArtifact =
18     { name, artifact }:
19     runCommandLocal name
20       {
21         nativeBuildInputs = [ zig ];
22       }
23       ''
24         hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})"
25         mv "$TMPDIR/p/$hash" "$out"
26         chmod 755 "$out"
27       '';
29   fetchZig =
30     {
31       name,
32       url,
33       hash,
34     }:
35     let
36       artifact = fetchurl { inherit url hash; };
37     in
38     unpackZigArtifact { inherit name artifact; };
40   fetchGitZig =
41     {
42       name,
43       url,
44       hash,
45     }:
46     let
47       parts = splitString "#" url;
48       url_base = elemAt parts 0;
49       url_without_query = elemAt (splitString "?" url_base) 0;
50       rev_base = elemAt parts 1;
51       rev = if match "^[a-fA-F0-9]{40}$" rev_base != null then rev_base else "refs/heads/${rev_base}";
52     in
53     fetchgit {
54       inherit name rev hash;
55       url = url_without_query;
56       deepClone = false;
57     };
59   fetchZigArtifact =
60     {
61       name,
62       url,
63       hash,
64     }:
65     let
66       parts = splitString "://" url;
67       proto = elemAt parts 0;
68       path = elemAt parts 1;
69       fetcher = {
70         "git+http" = fetchGitZig {
71           inherit name hash;
72           url = "http://${path}";
73         };
74         "git+https" = fetchGitZig {
75           inherit name hash;
76           url = "https://${path}";
77         };
78         http = fetchZig {
79           inherit name hash;
80           url = "http://${path}";
81         };
82         https = fetchZig {
83           inherit name hash;
84           url = "https://${path}";
85         };
86       };
87     in
88     fetcher.${proto};
90 linkFarm name [
91   {
92     name = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242";
93     path = fetchZigArtifact {
94       name = "zig-wayland";
95       url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz";
96       hash = "sha256-gxzkHLCq2NqX3l4nEly92ARU5dqP1SqnjpGMDgx4TXA=";
97     };
98   }
99   {
100     name = "1220c90b2228d65fd8427a837d31b0add83e9fade1dcfa539bb56fd06f1f8461605f";
101     path = fetchZigArtifact {
102       name = "zig-xkbcommon";
103       url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz";
104       hash = "sha256-f5oEJU5i2qeVN3GBrnQcqzEJCiOT7l4ak7GQ6gw5cH0=";
105     };
106   }