6450642be3
Build and populate cache / tests (sydpkgs, nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixpkgs-unstable.tar.gz, sydpkgs) (push) Has been cancelled
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ lua5_2
|
|
, lua5_1
|
|
, stdenv
|
|
, makeWrapper
|
|
, fetchFromGitHub
|
|
, lib
|
|
, wantLad5_1 ? true
|
|
, wantLad5_2 ? true
|
|
, wantCaseInsensitivity ? false
|
|
}:
|
|
|
|
let
|
|
our-lua52 = lua5_2.withPackages (ps: with ps; [
|
|
lpeg
|
|
]);
|
|
our-lua51 = lua5_1.withPackages (ps: with ps; [
|
|
lpeg
|
|
]);
|
|
in stdenv.mkDerivation {
|
|
pname = "lad";
|
|
version = "5d2eafb";
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
];
|
|
src = fetchFromGitHub {
|
|
owner = "andremm";
|
|
repo = "lad";
|
|
rev = "5d2eafb8790d7a1030aca0dbb75201073aacd1d9";
|
|
hash = "sha256-oIKayAUuRDqiHmAD37A5RYcMTh1RtpNl0jLcc5h3718=";
|
|
};
|
|
LUA51 = lib.getExe our-lua51;
|
|
LUA52 = lib.getExe our-lua52;
|
|
patches = lib.optional wantCaseInsensitivity ./case-insensitivity.patch;
|
|
installPhase = ''
|
|
mkdir -p $out/bin $out/opt/{5.1,5.2}
|
|
cp 5.1/*.lua $out/opt/5.1/
|
|
cp 5.2/*.lua $out/opt/5.2/
|
|
${lib.optionalString wantLad5_1 ''
|
|
makeWrapper $LUA51 $out/bin/luaa-5.1 \
|
|
--add-flags $out/opt/5.1/assembler.lua
|
|
makeWrapper $LUA51 $out/bin/luad-5.1 \
|
|
--add-flags $out/opt/5.1/disassembler.lua
|
|
''}
|
|
${lib.optionalString wantLad5_2 ''
|
|
makeWrapper $LUA52 $out/bin/luaa-5.2 \
|
|
--add-flags $out/opt/5.2/luaa.lua
|
|
makeWrapper $LUA52 $out/bin/luad-5.2 \
|
|
--add-flags $out/opt/5.2/luad.lua
|
|
''}
|
|
'';
|
|
}
|