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

35 lines
820 B
Nix

{ stdenv, qbe, hare-as, hare-cc, hare-ld }:
let
arch = stdenv.hostPlatform.uname.processor;
qbePlatform = {
x86_64 = "amd64_apple";
aarch64 = "arm64_apple";
}.${arch};
in
stdenv.mkDerivation (finalAttrs: {
pname = "harec";
version = "0.24";
src = builtins.fetchGit {
url = "https://github.com/badboy/harelang-harec";
ref = "master";
rev = "873311b721dca691706909964cc108139ebee0de";
};
buildInputs = [ qbe ];
nativeBuildInputs = [ qbe ];
doCheck = true;
makeFlags = [
"PREFIX=${builtins.placeholder "out"}"
"ARCH=${arch}"
"VERSION=${finalAttrs.version}-nixpkgs"
"QBEFLAGS=-t${qbePlatform}"
"CC=${hare-cc}/bin/hare-cc"
"AS=${hare-as}/bin/hare-as"
"LD=${hare-ld}/bin/hare-ld"
];
postConfigure = ''
ln -s configs/darwin.mk config.mk
'';
})