Skip to content

Commit

Permalink
Fix nix build with zig deps
Browse files Browse the repository at this point in the history
Signed-off-by: emneo <emneo@kreog.com>
  • Loading branch information
emneo-dev committed Sep 9, 2024
1 parent 5b392be commit 9044196
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
28 changes: 28 additions & 0 deletions build.zig.zon.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# generated by a zon2nix fork (https://github.com/emneo-dev/zon2nix)
{
linkFarm,
fetchzip,
}:
linkFarm "zig-packages" [
{
name = "1220232ab38d0c2cfb10680115c17ad2fa1a8531dbaf8bbfb359ec67e80c7d5f5758";
path = fetchzip {
url = "https://github.com/karlseguin/metrics.zig/archive/8892dce43b46a69c8e736329629f38df232adee1.tar.gz";
hash = "sha256-JN+s2VI6zKotfJ4sDbGrjSBz3JAVrcZk3npkXUNOMho=";
};
}
{
name = "1220b0979ea9891fa4aeb85748fc42bc4b24039d9c99a4d65d893fb1c83e921efad8";
path = fetchzip {
url = "https://github.com/ziglibs/ini/archive/e18d36665905c1e7ba0c1ce3e8780076b33e3002.tar.gz";
hash = "sha256-PmhXsK+mTmOrRC4u8cs9ol2XwKZv0HVRXpntaR5CJiw=";
};
}
{
name = "1220c032d828e768348b321a79523812be1c4cb27e1eb7ff5df54b573fa131afd448";
path = fetchzip {
url = "https://github.com/karlseguin/log.zig/archive/97d0818270a357d3ce7bc878abc32dc996fe78ff.tar.gz";
hash = "sha256-ahqqywOKsSlucCPmmqaZjrayNgUXoQV3w4VazsKgkyI=";
};
}
]
16 changes: 3 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,11 @@

src = pkgs.lib.cleanSource ./.;
buildInputs = [
zig
zig.hook
];

buildPhase = ''
zig build -Doptimize=ReleaseSafe
'';

doCheck = true;
checkPhase = ''
zig build test -Doptimize=ReleaseSafe
'';

installPhase = ''
zig build install --prefix $out -Doptimize=ReleaseSafe
rm -rf $out/zig # remove cache
postPatch = ''
ln -s ${pkgs.callPackage ./build.zig.zon.nix {}} $ZIG_GLOBAL_CACHE_DIR/p
'';
};
};
Expand Down

0 comments on commit 9044196

Please sign in to comment.