Created
May 15, 2023 21:24
-
-
Save maxsei/7c4cbef9e1b4987b70faa1612be9bb92 to your computer and use it in GitHub Desktop.
running gnueabihf with zig on nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { lib, fetchFromGitHub, cmake, llvmPackages_13, libxml2, zlib }: | |
| let inherit (llvmPackages_13) stdenv; | |
| in stdenv.mkDerivation rec { | |
| pname = "zig"; | |
| version = "0.9.1"; | |
| src = fetchFromGitHub { | |
| owner = "ziglang"; | |
| repo = pname; | |
| rev = version; | |
| hash = "sha256-x2c4c9RSrNWGqEngio4ArW7dJjW0gg+8nqBwPcR721k="; | |
| }; | |
| nativeBuildInputs = [ cmake llvmPackages.llvm.dev ]; | |
| buildInputs = [ libxml2 zlib ] ++ (with llvmPackages; [ libclang lld llvm ]); | |
| preBuild = '' | |
| export HOME=$TMPDIR; | |
| ''; | |
| # installPhase = let | |
| postInstall = let | |
| armFeatures = builtins.fetchurl { | |
| url = "https://sourceware.org/git/?p=glibc.git;" | |
| + "a=blob_plain;f=sysdeps/arm/arm-features.h;" | |
| + "h=80a1e2272b5b4ee0976a410317341b5ee601b794;" | |
| + "hb=0281c7a7ec8f3f46d8e6f5f3d7fca548946dbfce"; | |
| name = "glibc-2.35_arm-features.h"; | |
| sha256 = "1g4yb51srrfbd4289yj0vrpzzp2rlxllxgz8q4a5zw1n654wzs5a"; | |
| }; | |
| in '' | |
| cp ${armFeatures} $out/lib/zig/libc/glibc/sysdeps/arm//arm-features.h | |
| # printenv cc_impl >$out/bin/cc | |
| # chmod a+x $out/bin/cc | |
| ''; | |
| # doCheck = true; | |
| doCheck = false; | |
| checkPhase = '' | |
| runHook preCheck | |
| ./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig | |
| runHook postCheck | |
| ''; | |
| meta = with lib; { | |
| homepage = "https://ziglang.org/"; | |
| description = | |
| "General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software"; | |
| license = licenses.mit; | |
| maintainers = with maintainers; [ andrewrk AndersonTorres ]; | |
| platforms = platforms.unix; | |
| broken = | |
| stdenv.isDarwin; # See https://github.com/NixOS/nixpkgs/issues/86299 | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment