Commit 4c85983b3e3a

Vincent Demeester <vincent@sbr.pm>
2025-12-04 22:54:36
refactor(pkgs): remove deprecated builder scripts and modernize packages
- Eliminate deprecated builder = ./builder.sh pattern from 4 packages - Add proper runHooks to enable customization via overlays - Standardize package definitions with pname+version and meta sections - Align with nixpkgs best practices for maintainability Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 0faf566
pkgs/chmouzies/ai.nix
@@ -1,15 +1,14 @@
 # https://github.com/chmouel/chmouzies/tree/master/kubernetes
 {
   stdenv,
+  lib,
   fetchFromGitLab,
   python313,
   installShellFiles,
 }:
 
-stdenv.mkDerivation rec {
-  name = "chmouzies-ai";
+stdenv.mkDerivation {
   pname = "chmouzies-ai";
-
   version = "0-unstable-2025-09-30";
 
   src = fetchFromGitLab {
@@ -22,5 +21,27 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ python313 ];
   nativeBuildInputs = [ installShellFiles ];
 
-  builder = ./builder.ai.sh;
+  installPhase =
+    let
+      binaries = [
+        "aicommit"
+        "git-commit-suggest-label"
+      ];
+    in
+    ''
+      runHook preInstall
+
+      mkdir -p $out/bin
+      ${lib.concatMapStringsSep "\n" (b: "cp $src/ai/${b} $out/bin/") binaries}
+
+      installShellCompletion --cmd aicommit --zsh $src/ai/_aicommit
+
+      runHook postInstall
+    '';
+
+  meta = with lib; {
+    description = "Chmouel's AI-assisted git tools";
+    homepage = "https://gitlab.com/chmouel/chmouzies";
+    platforms = platforms.unix;
+  };
 }
pkgs/chmouzies/builder.ai.sh
@@ -1,11 +0,0 @@
-source $stdenv/setup
-ls $stdenv
-
-BINARIES="aicommit git-commit-suggest-label"
-
-mkdir -p $out/bin
-for b in ${BINARIES}; do
-	cp $src/ai/${b} $out/bin/
-done
-
-installShellCompletion --cmd aicommit --zsh $src/ai/_aicommit
pkgs/chmouzies/builder.git.sh
@@ -1,12 +0,0 @@
-source $stdenv/setup
-ls $stdenv
-
-BINARIES="gh-prcheck gh-actionfollow gh-clone gh-issuef gh-issuecreate gh-completer git-branch-cleanup git-remote-branch git-wt-delete git-wt-create"
-
-mkdir -p $out/bin
-for b in ${BINARIES}; do
-	cp $src/git/${b} $out/bin/
-done
-
-installShellCompletion --cmd gh-issuecreate --zsh $src/git/_gh-issuecreate
-installShellCompletion --cmd gh-clone --zsh $src/git/_gh-clone
pkgs/chmouzies/builder.kubernetes.sh
@@ -1,15 +0,0 @@
-source $stdenv/setup
-ls $stdenv
-
-BINARIES="ocla kcl kdd kdp kselect kubectl-get-secret"
-
-mkdir -p $out/bin
-for b in ${BINARIES}; do
-	cp $src/kubernetes/${b} $out/bin/
-done
-
-installShellCompletion --cmd kcl --zsh $src/kubernetes/_kcl
-installShellCompletion --cmd kdd --zsh $src/kubernetes/_kdd
-installShellCompletion --cmd kdp --zsh $src/kubernetes/_kdp
-installShellCompletion --cmd kselect --zsh $src/kubernetes/_kselect
-installShellCompletion --cmd ocla --zsh $src/kubernetes/_ocla
pkgs/chmouzies/git.nix
@@ -1,15 +1,14 @@
 # https://github.com/chmouel/chmouzies/tree/master/kubernetes
 {
   stdenv,
+  lib,
   fetchFromGitLab,
   python313,
   installShellFiles,
 }:
 
-stdenv.mkDerivation rec {
-  name = "chmouzies-git";
+stdenv.mkDerivation {
   pname = "chmouzies-git";
-
   version = "0-unstable-2025-09-30";
 
   src = fetchFromGitLab {
@@ -22,5 +21,36 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ python313 ];
   nativeBuildInputs = [ installShellFiles ];
 
-  builder = ./builder.git.sh;
+  installPhase =
+    let
+      binaries = [
+        "gh-prcheck"
+        "gh-actionfollow"
+        "gh-clone"
+        "gh-issuef"
+        "gh-issuecreate"
+        "gh-completer"
+        "git-branch-cleanup"
+        "git-remote-branch"
+        "git-wt-delete"
+        "git-wt-create"
+      ];
+    in
+    ''
+      runHook preInstall
+
+      mkdir -p $out/bin
+      ${lib.concatMapStringsSep "\n" (b: "cp $src/git/${b} $out/bin/") binaries}
+
+      installShellCompletion --cmd gh-issuecreate --zsh $src/git/_gh-issuecreate
+      installShellCompletion --cmd gh-clone --zsh $src/git/_gh-clone
+
+      runHook postInstall
+    '';
+
+  meta = with lib; {
+    description = "Chmouel's git-related helper scripts and GitHub CLI extensions";
+    homepage = "https://gitlab.com/chmouel/chmouzies";
+    platforms = platforms.unix;
+  };
 }
pkgs/chmouzies/kubernetes.nix
@@ -1,15 +1,14 @@
 # https://github.com/chmouel/chmouzies/tree/master/kubernetes
 {
   stdenv,
+  lib,
   fetchFromGitLab,
   python313,
   installShellFiles,
 }:
 
-stdenv.mkDerivation rec {
-  name = "chmouzies-kubernetes";
+stdenv.mkDerivation {
   pname = "chmouzies-kubernetes";
-
   version = "0-unstable-2025-09-30";
 
   src = fetchFromGitLab {
@@ -22,5 +21,35 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ python313 ];
   nativeBuildInputs = [ installShellFiles ];
 
-  builder = ./builder.kubernetes.sh;
+  installPhase =
+    let
+      binaries = [
+        "ocla"
+        "kcl"
+        "kdd"
+        "kdp"
+        "kselect"
+        "kubectl-get-secret"
+      ];
+    in
+    ''
+      runHook preInstall
+
+      mkdir -p $out/bin
+      ${lib.concatMapStringsSep "\n" (b: "cp $src/kubernetes/${b} $out/bin/") binaries}
+
+      installShellCompletion --cmd kcl --zsh $src/kubernetes/_kcl
+      installShellCompletion --cmd kdd --zsh $src/kubernetes/_kdd
+      installShellCompletion --cmd kdp --zsh $src/kubernetes/_kdp
+      installShellCompletion --cmd kselect --zsh $src/kubernetes/_kselect
+      installShellCompletion --cmd ocla --zsh $src/kubernetes/_ocla
+
+      runHook postInstall
+    '';
+
+  meta = with lib; {
+    description = "Chmouel's Kubernetes and OpenShift helper scripts";
+    homepage = "https://gitlab.com/chmouel/chmouzies";
+    platforms = platforms.unix;
+  };
 }
pkgs/my/scripts/builder.sh
@@ -1,4 +0,0 @@
-source $stdenv/setup
-
-mkdir -p $out/bin
-cp $src/bin/* $out/bin/
pkgs/my/scripts/default.nix
@@ -1,7 +1,25 @@
-{ stdenv }:
+{
+  stdenv,
+  lib,
+}:
 
 stdenv.mkDerivation {
-  name = "vde-scripts-0.4";
-  builder = ./builder.sh;
+  pname = "vde-scripts";
+  version = "0.4";
+
   src = ./.;
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin
+    cp $src/bin/* $out/bin/
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Vincent's personal scripts collection";
+    platforms = platforms.unix;
+  };
 }