From 89cba0436971a7ee587b77f6b938d5ae6094a893 Mon Sep 17 00:00:00 2001 From: Alex James Date: Fri, 23 May 2025 13:37:13 -0500 Subject: [PATCH] nerd-font-patcher: update patches for 3.4.0 One of the commits included in 3.4.0 [1] broke the patch to update the path to the glyphs directory [2]. Replace the `postPatch` hook with an explicit patch to update the paths in the font-patcher script. [1]: https://github.com/ryanoasis/nerd-fonts/commit/34a14990b042c90b3ff90871bc1d3f3978130acc [2]: https://github.com/NixOS/nixpkgs/pull/409580#issuecomment-2903671914 --- pkgs/by-name/ne/nerd-font-patcher/package.nix | 10 +++------ .../ne/nerd-font-patcher/use-nix-paths.patch | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 pkgs/by-name/ne/nerd-font-patcher/use-nix-paths.patch diff --git a/pkgs/by-name/ne/nerd-font-patcher/package.nix b/pkgs/by-name/ne/nerd-font-patcher/package.nix index bb66a717bda7..44b1f3136fe8 100644 --- a/pkgs/by-name/ne/nerd-font-patcher/package.nix +++ b/pkgs/by-name/ne/nerd-font-patcher/package.nix @@ -18,13 +18,9 @@ python3Packages.buildPythonApplication rec { format = "other"; - postPatch = '' - sed -i font-patcher \ - -e 's,__dir__ + "/src,"'$out'/share/,' - sed -i font-patcher \ - -e 's,/bin/scripts/name_parser,/../lib/name_parser,' - ''; - # Note: we cannot use $out for second substitution + patches = [ + ./use-nix-paths.patch + ]; dontBuild = true; diff --git a/pkgs/by-name/ne/nerd-font-patcher/use-nix-paths.patch b/pkgs/by-name/ne/nerd-font-patcher/use-nix-paths.patch new file mode 100644 index 000000000000..02fb78916a9b --- /dev/null +++ b/pkgs/by-name/ne/nerd-font-patcher/use-nix-paths.patch @@ -0,0 +1,22 @@ +diff --git a/font-patcher b/font-patcher +index c48039f2c..e776adfbc 100755 +--- a/font-patcher ++++ b/font-patcher +@@ -38,7 +38,7 @@ except ImportError: + ) + ) + +-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'bin', 'scripts', 'name_parser')) ++sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), '..', 'lib', 'name_parser')) + try: + from FontnameParser import FontnameParser + from FontnameTools import FontnameTools +@@ -2075,7 +2075,7 @@ def setup_arguments(): + expert_group.add_argument('--configfile', dest='configfile', default=False, type=str, help='Specify a file path for configuration file (see sample: src/config.sample.cfg)') + expert_group.add_argument('--custom', dest='custom', default=False, type=str, help='Specify a custom symbol font, all glyphs will be copied; absolute path suggested') + expert_group.add_argument('--dry', dest='dry_run', default=False, action='store_true', help='Do neither patch nor store the font, to check naming') +- expert_group.add_argument('--glyphdir', dest='glyphdir', default=__dir__ + "/src/glyphs/", type=str, help='Path to glyphs to be used for patching') ++ expert_group.add_argument('--glyphdir', dest='glyphdir', default=__dir__ + "/../share/glyphs/", type=str, help='Path to glyphs to be used for patching') + expert_group.add_argument('--has-no-italic', dest='noitalic', default=False, action='store_true', help='Font family does not have Italic (but Oblique), to help create correct RIBBI set') + expert_group.add_argument('--metrics', dest='metrics', default=None, choices=get_metrics_names(), help='Select vertical metrics source (for problematic cases)') + expert_group.add_argument('--name', dest='force_name', default=None, type=str, help='Specify naming source (\'full\', \'postscript\', \'filename\', or concrete free name-string)')