From 69316a8b4aa5addf343a1d0bd85b974ef7a3913e Mon Sep 17 00:00:00 2001 From: chayleaf Date: Tue, 28 Feb 2023 22:01:44 +0700 Subject: [PATCH 1/2] maintainers: add chayleaf --- maintainers/maintainer-list.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 53f162af62a..7f28a553a0c 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -2845,6 +2845,13 @@ githubId = 6608071; name = "Charles Huyghues-Despointes"; }; + chayleaf = { + email = "chayleaf-nix@pavluk.org"; + github = "chayleaf"; + githubId = 9590981; + matrix = "@chayleaf:matrix.pavluk.org"; + name = "Anna Pavlyuk"; + }; chekoopa = { email = "chekoopa@mail.ru"; github = "chekoopa"; From 631b86bfd0f9162dd3f968ecb64d099b55cd9375 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Wed, 1 Mar 2023 00:45:43 +0700 Subject: [PATCH 2/2] lalrpop: init at 0.20.0 --- pkgs/development/tools/lalrpop/default.nix | 46 +++++++++++++++++++ .../use-correct-binary-path-in-tests.patch | 13 ++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 61 insertions(+) create mode 100644 pkgs/development/tools/lalrpop/default.nix create mode 100644 pkgs/development/tools/lalrpop/use-correct-binary-path-in-tests.patch diff --git a/pkgs/development/tools/lalrpop/default.nix b/pkgs/development/tools/lalrpop/default.nix new file mode 100644 index 00000000000..1679417cbdd --- /dev/null +++ b/pkgs/development/tools/lalrpop/default.nix @@ -0,0 +1,46 @@ +{ lib +, rustPlatform +, rust +, 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; + target_triple = rust.toRustTarget stdenv.hostPlatform; + }) + ]; + + 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 ]; + maintainers = with maintainers; [ chayleaf ]; + }; +} diff --git a/pkgs/development/tools/lalrpop/use-correct-binary-path-in-tests.patch b/pkgs/development/tools/lalrpop/use-correct-binary-path-in-tests.patch new file mode 100644 index 00000000000..c7e691b864e --- /dev/null +++ b/pkgs/development/tools/lalrpop/use-correct-binary-path-in-tests.patch @@ -0,0 +1,13 @@ +diff --git a/lalrpop-test/src/lib.rs b/lalrpop-test/src/lib.rs +index cb4f2b0..725b0d4 100644 +--- a/lalrpop-test/src/lib.rs ++++ b/lalrpop-test/src/lib.rs +@@ -1089,7 +1089,7 @@ fn verify_lalrpop_generates_itself() { + // Don't remove the .rs file that already exist + fs::copy(&grammar_file, &copied_grammar_file).expect("no grammar file found"); + +- assert!(Command::new("../target/debug/lalrpop") ++ assert!(Command::new("../target/@target_triple@/release/lalrpop") + .args([ + "--force", + "--no-whitespace", diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6b8e9f36178..56b7aa66ab7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9416,6 +9416,8 @@ with pkgs; lalezar-fonts = callPackage ../data/fonts/lalezar-fonts { }; + lalrpop = callPackage ../development/tools/lalrpop { }; + last-resort = callPackage ../data/fonts/last-resort { }; ldc = callPackage ../development/compilers/ldc { };