2023-02-28 17:45:43 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, substituteAll
|
|
|
|
, stdenv
|
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "lalrpop";
|
|
|
|
version = "0.20.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lalrpop";
|
|
|
|
repo = "lalrpop";
|
|
|
|
# there's no tag for 0.20.0
|
|
|
|
rev = "1584ddb243726195b540fdd2b3ccf693876288e0";
|
|
|
|
# rev = version;
|
|
|
|
hash = "sha256-aYlSR8XqJnj76Hm3MFqfA5d9L3SO/iCCKpzOES5YQGY=";
|
|
|
|
};
|
|
|
|
|
|
|
|
cargoHash = "sha256-JaU5ZJbmlV/HfFT/ODpB3xFjZc2XiljhEVz/dql8o/c=";
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./use-correct-binary-path-in-tests.patch;
|
lib.systems: elaborate Rust metadata
We need this stuff to be available in lib so make-derivation.nix can
access it to construct the Meson cross file.
This has a couple of other advantages:
- It makes Rust less special. Now figuring out what Rust calls a
platform is the same as figuring out what Linux or QEMU call it.
- We can unify the schema used to define Rust targets, and the schema
used to access those values later. Just like you can set "config"
or "system" in a platform definition, and then access those same
keys on the elaborated platform, you can now set "rustcTarget" in
your crossSystem, and then access "stdenv.hostPlatform.rustcTarget"
in your code.
"rustcTarget", "rustcTargetSpec", "cargoShortTarget", and
"cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because
these are not exposed to code by the compiler, and are not
standardized. The arch/os/etc. variables are all named to match the
forms in the Rust target spec JSON.
The new rust.target-family only takes a list, since we don't need to
worry about backwards compatibility when that name is used.
The old APIs are all still functional with no warning for now, so that
it's possible for external code to use a single API on both 23.05 and
23.11. We can introduce the warnings once 23.05 is EOL, and make them
hard errors when 23.11 is EOL.
2023-05-09 13:38:32 +00:00
|
|
|
target_triple = stdenv.hostPlatform.rust.rustcTarget;
|
2023-02-28 17:45:43 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
buildAndTestSubdir = "lalrpop";
|
|
|
|
|
|
|
|
# there are some tests in lalrpop-test and some in lalrpop
|
|
|
|
checkPhase = ''
|
|
|
|
buildAndTestSubdir=lalrpop-test cargoCheckHook
|
|
|
|
cargoCheckHook
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "LR(1) parser generator for Rust";
|
|
|
|
homepage = "https://github.com/lalrpop/lalrpop";
|
|
|
|
changelog = "https://github.com/lalrpop/lalrpop/blob/${src.rev}/RELEASES.md";
|
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
2023-08-13 17:09:12 +00:00
|
|
|
mainProgram = "lalrpop";
|
2023-02-28 17:45:43 +00:00
|
|
|
maintainers = with maintainers; [ chayleaf ];
|
|
|
|
};
|
|
|
|
}
|