1
Fork 0
hare-nix/pkgs/harec.nix

35 lines
812 B
Nix
Raw Normal View History

{ stdenv, qbe, hareAs, hareCc, hareLd }:
2024-05-14 19:02:43 +00:00
let
arch = stdenv.hostPlatform.uname.processor;
qbePlatform = {
2024-05-14 19:06:04 +00:00
x86_64 = "amd64_apple";
aarch64 = "arm64_apple";
2024-05-14 19:02:43 +00:00
}.${arch};
in
stdenv.mkDerivation (finalAttrs: {
pname = "harec";
version = "0.24";
src = builtins.fetchGit {
2024-05-14 19:06:04 +00:00
url = "https://github.com/hshq/harelang-harec";
2024-05-14 19:02:43 +00:00
ref = "master";
rev = "51446fdef8b39df1fbf4fa2644d3f51f020f974a";
};
buildInputs = [ qbe ];
nativeBuildInputs = [ qbe ];
doCheck = true;
2024-05-14 19:02:43 +00:00
makeFlags = [
"PREFIX=${builtins.placeholder "out"}"
"ARCH=${arch}"
"VERSION=${finalAttrs.version}-nixpkgs"
"QBEFLAGS=-t${qbePlatform}"
"CC=${hareCc}/bin/hare-cc"
"AS=${hareAs}/bin/hare-as"
"LD=${hareLd}/bin/hare-ld"
2024-05-14 19:02:43 +00:00
];
postConfigure = ''
ln -s configs/darwin.mk config.mk
'';
})