Commit babb9a9

HPCesia <me@hpcesia.com>
2026-06-25 16:20:04
refactor: remove `-hx` suffix of helix plugins
1 parent 2ba1317
lib/default.nix
@@ -1,7 +1,13 @@
-{ pkgs }:
-
+{pkgs}:
 with pkgs.lib; {
-  # Add your library functions here
-  #
-  # hexint = x: hexvals.${toLower x};
+  renamePackage = oldName: newName: drv:
+    derivations.warnOnInstantiate
+    "${oldName} has been renamed to ${newName}"
+    (drv.overrideAttrs (old: {
+      meta =
+        (old.meta or {})
+        // {
+          nurRenamed = true;
+        };
+    }));
 }
pkgs/helix-plugins/default.nix
@@ -1,5 +1,6 @@
 {
   lib,
+  selfLib,
   newScope,
 }:
 lib.makeScope newScope (
@@ -9,12 +10,15 @@ lib.makeScope newScope (
 
       fcitx-focus = callPackage ./fcitx-focus.nix {};
 
-      file-tree = callPackage ./file-tree-hx.nix {};
+      file-tree = callPackage ./file-tree.nix {};
+      file-tree-hx = selfLib.renamePackage "helixPlugins.file-tree-hx" "helixPlugins.file-tree" self.file-tree;
 
       helix-file-watcher = callPackage ./helix-file-watcher.nix {};
 
-      scooter-hx = callPackage ./scooter-hx.nix {};
+      scooter = callPackage ./scooter.nix {};
+      scooter-hx = selfLib.renamePackage "helixPlugins.scooter-hx" "helixPlugins.scooter" self.scooter;
 
-      wakatime-hx = callPackage ./wakatime-hx.nix {};
+      wakatime = callPackage ./wakatime.nix {};
+      wakatime-hx = selfLib.renamePackage "helixPlugins.wakatime-hx" "helixPlugins.wakatime" self.wakatime;
     }
 )
pkgs/helix-plugins/file-tree-hx.nix โ†’ pkgs/helix-plugins/file-tree.nix
File renamed without changes
pkgs/helix-plugins/scooter-hx.nix โ†’ pkgs/helix-plugins/scooter.nix
File renamed without changes
pkgs/helix-plugins/wakatime-hx.nix โ†’ pkgs/helix-plugins/wakatime.nix
File renamed without changes
scripts/gen-readme.py
@@ -80,7 +80,8 @@ let
             license = getLic v.meta;
           }};
         in
-          if isDer v then [ pkgInfo ]
+          if isDer v then
+            if v.meta.nurRenamed or false then [] else [ pkgInfo ]
           else if isScope v then collect fullPrefix v
           else []
       ) names;
default.nix
@@ -6,39 +6,42 @@
 # Having pkgs default to <nixpkgs> is fine though, and it lets you use short
 # commands such as:
 #     nix-build -A mypackage
-{pkgs ? import <nixpkgs> {}}: {
+{pkgs ? import <nixpkgs> {}}: let
+  selfLib = import ./lib {inherit pkgs;};
+  callPackage = pkgs.lib.callPackageWith (pkgs // {inherit selfLib;});
+in {
   # The `lib`, `overlays`, `nixosModules`, `homeModules`,
   # `darwinModules` and `flakeModules` names are special
-  lib = import ./lib {inherit pkgs;}; # functions
+  lib = selfLib;
   nixosModules = import ./nixos-modules; # NixOS modules
   # homeModules = { }; # Home Manager modules
   # darwinModules = { }; # nix-darwin modules
   # flakeModules = { }; # flake-parts modules
   overlays = import ./overlays; # nixpkgs overlays
 
-  dwproton-bin = pkgs.callPackage ./pkgs/dwproton-bin {};
+  dwproton-bin = callPackage ./pkgs/dwproton-bin {};
 
-  elio = pkgs.callPackage ./pkgs/elio {};
+  elio = callPackage ./pkgs/elio {};
 
-  harmonoid = pkgs.callPackage ./pkgs/harmonoid {};
+  harmonoid = callPackage ./pkgs/harmonoid {};
 
-  helixPlugins = pkgs.callPackage ./pkgs/helix-plugins {};
+  helixPlugins = callPackage ./pkgs/helix-plugins {};
 
-  kelivo = pkgs.callPackage ./pkgs/kelivo {};
+  kelivo = callPackage ./pkgs/kelivo {};
 
-  miaomiaowu = pkgs.callPackage ./pkgs/miaomiaowu {};
+  miaomiaowu = callPackage ./pkgs/miaomiaowu {};
 
-  localbooru-bin = pkgs.callPackage ./pkgs/localbooru-bin {};
+  localbooru-bin = callPackage ./pkgs/localbooru-bin {};
 
-  mo2-lint = pkgs.callPackage ./pkgs/mo2-lint {};
+  mo2-lint = callPackage ./pkgs/mo2-lint {};
 
-  musly-player = pkgs.callPackage ./pkgs/musly-player {};
+  musly-player = callPackage ./pkgs/musly-player {};
 
-  nocturne = pkgs.callPackage ./pkgs/nocturne {};
+  nocturne = callPackage ./pkgs/nocturne {};
 
-  particle-music = pkgs.callPackage ./pkgs/particle-music {};
+  particle-music = callPackage ./pkgs/particle-music {};
 
-  shimmie2 = pkgs.callPackage ./pkgs/shimmie2 {};
+  shimmie2 = callPackage ./pkgs/shimmie2 {};
 
-  spritz-wine-bin = pkgs.callPackage ./pkgs/spritz-wine-bin {};
+  spritz-wine-bin = callPackage ./pkgs/spritz-wine-bin {};
 }
README.md
@@ -31,7 +31,7 @@
 | `helixPlugins.fcitx-focus` | [helix-fcitx-focus](https://github.com/mtul0729/helix-fcitx-focus) | `unstable-2026-05-06` | [MIT](https://spdx.org/licenses/MIT.html) | Steel native module for Helix fcitx5 focus and mode switching |
 | `helixPlugins.file-tree` | [file-tree.hx](https://github.com/mattwparas/file-tree.hx) | `unstable-2026-05-01` | Not specified | File tree for helix, using Steel. |
 | `helixPlugins.helix-file-watcher` | [helix-file-watcher](https://github.com/mattwparas/helix-file-watcher) | `unstable-2026-05-21` | Not specified | Helix file watcher plugin |
-| `helixPlugins.scooter-hx` | [scooter.hx](https://github.com/thomasschafer/scooter.hx) | `unstable-2026-03-15` | [MIT](https://spdx.org/licenses/MIT.html) | Interactive find-and-replace Helix plugin |
-| `helixPlugins.wakatime-hx` | [wakatime.hx](https://github.com/Xerxes-2/wakatime.hx) | `unstable-2026-05-01` | [MIT](https://spdx.org/licenses/MIT.html) | Wakatime plugin for Helix Steel |
+| `helixPlugins.scooter` | [scooter.hx](https://github.com/thomasschafer/scooter.hx) | `unstable-2026-03-15` | [MIT](https://spdx.org/licenses/MIT.html) | Interactive find-and-replace Helix plugin |
+| `helixPlugins.wakatime` | [wakatime.hx](https://github.com/Xerxes-2/wakatime.hx) | `unstable-2026-05-01` | [MIT](https://spdx.org/licenses/MIT.html) | Wakatime plugin for Helix Steel |
 
 <!-- END_PACKAGE_TABLE -->