From e8a3a3ef433100f1a8a956680d8bb99c3403bd8e Mon Sep 17 00:00:00 2001 From: Tomas Rivera Date: Tue, 28 Apr 2026 14:55:12 +0200 Subject: [PATCH] tried to ameliorate syllabe counter --- modules/packages/plint.nix | 51 ++++++++++++++++++++++++++++++++++++ modules/scripts/syllabes.nix | 7 +++-- 2 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 modules/packages/plint.nix diff --git a/modules/packages/plint.nix b/modules/packages/plint.nix new file mode 100644 index 0000000..6622506 --- /dev/null +++ b/modules/packages/plint.nix @@ -0,0 +1,51 @@ +{ lib +, python3Packages +, fetchFromGitLab +, frhyme +, haspirater +}: + +python3Packages.buildPythonApplication rec { + pname = "plint"; + + # No PyPI version mentioned; upstream is git-based + version = "unstable-2026-04-28"; + + src = fetchFromGitLab { + owner = "a3nm"; + repo = "plint"; + rev = "master"; + sha256 = lib.fakeSha256; # replace after first build + }; + + propagatedBuildInputs = [ + frhyme + haspirater + python3Packages.cherrypy + ]; + + # plint uses scripts + data generation steps, so disable strict tests + doCheck = false; + + preBuild = '' + # required data generation steps from README + echo "Generating frhyme.json..." + (cd frhyme/lexique && ./lexique_retrieve.sh > lexique.txt) + (cd frhyme && ./make.sh 4 lexique/lexique.txt additions > frhyme.json) + + echo "Generating occurrences file..." + ./lexique_occurrences_retrieve.sh > data/occurrences || true + ''; + + postInstall = '' + # ensure CLI entry point exists + install -Dm755 plint.py $out/bin/plint + ''; + + meta = with lib; { + description = "French poetry validator (metrics, rhymes, template checking)"; + homepage = "https://gitlab.com/a3nm/plint"; + license = licenses.gpl3Plus; + platforms = platforms.unix; + }; +} diff --git a/modules/scripts/syllabes.nix b/modules/scripts/syllabes.nix index bf0a76d..cb7ec98 100644 --- a/modules/scripts/syllabes.nix +++ b/modules/scripts/syllabes.nix @@ -1,4 +1,3 @@ -/* old version { pkgs, python3Packages, ... }: pkgs.writers.writePython3Bin "custom-syllabes" { @@ -23,7 +22,7 @@ for w in text.split(): total += len(parts) print(f"{total} ({'/'.join(chunks)})") -''*/ +'' /* used IPA but had a deprecated dependency { pkgs, python3Packages, ... }: @@ -58,7 +57,7 @@ for word in text.split(): print(f"{total} ({' | '.join(chunks)})") ''*/ -{ pkgs, ... }: +/*{ pkgs, ... }: let lexique = pkgs.fetchurl { @@ -171,4 +170,4 @@ def main(): if __name__ == "__main__": main() -'' +''*/