From 29da5a77c81c6793dc0b2335a38fd495efeb03fb Mon Sep 17 00:00:00 2001
From: clerie <git@clerie.de>
Date: Wed, 12 Mar 2025 20:50:49 +0100
Subject: [PATCH] pkgs/overlay.nix: Generate overlay from attrset we can use to
 automatically get the package names for our own packets from

---
 flake.nix        | 32 +-------------------------------
 pkgs/overlay.nix | 32 +-------------------------------
 pkgs/pkgs.nix    | 31 +++++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 62 deletions(-)
 create mode 100644 pkgs/pkgs.nix

diff --git a/flake.nix b/flake.nix
index 0d6b9e2..a5ce04f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -131,37 +131,7 @@
 
     packages = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: let
       pkgs = localNixpkgs.${system};
-    in {
-      inherit (pkgs)
-        clerie-backup
-        clerie-keys
-        clerie-system-remote-install
-        clerie-system-upgrade
-        clerie-merge-nixfiles-update
-        clerie-update-nixfiles
-        clerie-sops
-        clerie-sops-config
-        clerie-sops-edit
-        chromium-incognito
-        factorio-launcher
-        git-checkout-github-pr
-        git-diff-word
-        git-pp
-        git-show-link
-        harmonia
-        iot-data
-        nix-remove-result-links
-        nixfiles-auto-install
-        nixfiles-generate-config
-        nixfiles-generate-backup-secrets
-        nixfiles-update-ssh-host-keys
-        print-afra
-        run-with-docker-group
-        ssh-gpg
-        update-from-hydra
-        uptimestatus
-        xmppc;
-    });
+    in builtins.mapAttrs (name: value: pkgs."${name}") (import ./pkgs/pkgs.nix));
 
     inherit lib self;
 
diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
index 7caa76c..f2ab5dc 100644
--- a/pkgs/overlay.nix
+++ b/pkgs/overlay.nix
@@ -1,31 +1 @@
-final: prev: {
-  clerie-backup = final.callPackage ./clerie-backup {};
-  clerie-keys = final.callPackage ./clerie-keys {};
-  clerie-system-remote-install = final.callPackage ./clerie-system-remote-install {};
-  clerie-system-upgrade = final.callPackage ./clerie-system-upgrade/clerie-system-upgrade.nix {};
-  clerie-merge-nixfiles-update = final.callPackage ./clerie-update-nixfiles/clerie-merge-nixfiles-update.nix {};
-  clerie-sops = final.callPackage ./clerie-sops/clerie-sops.nix {};
-  clerie-sops-config = final.callPackage ./clerie-sops/clerie-sops-config.nix {};
-  clerie-sops-edit = final.callPackage ./clerie-sops/clerie-sops-edit.nix {};
-  clerie-update-nixfiles = final.callPackage ./clerie-update-nixfiles/clerie-update-nixfiles.nix {};
-  chromium-incognito = final.callPackage ./chromium-incognito {};
-  factorio-launcher = final.callPackage ./factorio-launcher {};
-  feeds-dir = final.callPackage ./feeds-dir {};
-  git-checkout-github-pr = final.callPackage ./git-checkout-github-pr {};
-  git-diff-word = final.callPackage ./git-diff-word {};
-  git-pp = final.callPackage ./git-pp {};
-  git-show-link = final.callPackage ./git-show-link {};
-  iot-data = final.python3.pkgs.callPackage ./iot-data {};
-  nix-remove-result-links = final.callPackage ./nix-remove-result-links {};
-  nixfiles-auto-install = final.callPackage ./nixfiles/nixfiles-auto-install.nix {};
-  nixfiles-generate-config = final.callPackage ./nixfiles/nixfiles-generate-config.nix {};
-  nixfiles-generate-backup-secrets = final.callPackage ./nixfiles/nixfiles-generate-backup-secrets.nix {};
-  nixfiles-update-ssh-host-keys = final.callPackage ./nixfiles/nixfiles-update-ssh-host-keys.nix {};
-  print-afra = final.callPackage ./print-afra {};
-  run-with-docker-group = final.callPackage ./run-with-docker-group {};
-  ssh-gpg = final.callPackage ./ssh-gpg {};
-  update-from-hydra = final.callPackage ./update-from-hydra {};
-  uptimestatus = final.python3.pkgs.callPackage ./uptimestatus {};
-
-  xmppc = import ./overrides/xmppc.nix final prev;
-}
+final: prev: builtins.mapAttrs (name: value: value final prev) (import ./pkgs.nix)
diff --git a/pkgs/pkgs.nix b/pkgs/pkgs.nix
new file mode 100644
index 0000000..2b70d54
--- /dev/null
+++ b/pkgs/pkgs.nix
@@ -0,0 +1,31 @@
+{
+  clerie-backup = final: prev: final.callPackage ./clerie-backup {};
+  clerie-keys = final: prev: final.callPackage ./clerie-keys {};
+  clerie-system-remote-install = final: prev: final.callPackage ./clerie-system-remote-install {};
+  clerie-system-upgrade = final: prev: final.callPackage ./clerie-system-upgrade/clerie-system-upgrade.nix {};
+  clerie-merge-nixfiles-update = final: prev: final.callPackage ./clerie-update-nixfiles/clerie-merge-nixfiles-update.nix {};
+  clerie-sops = final: prev: final.callPackage ./clerie-sops/clerie-sops.nix {};
+  clerie-sops-config = final: prev: final.callPackage ./clerie-sops/clerie-sops-config.nix {};
+  clerie-sops-edit = final: prev: final.callPackage ./clerie-sops/clerie-sops-edit.nix {};
+  clerie-update-nixfiles = final: prev: final.callPackage ./clerie-update-nixfiles/clerie-update-nixfiles.nix {};
+  chromium-incognito = final: prev: final.callPackage ./chromium-incognito {};
+  factorio-launcher = final: prev: final.callPackage ./factorio-launcher {};
+  feeds-dir = final: prev: final.callPackage ./feeds-dir {};
+  git-checkout-github-pr = final: prev: final.callPackage ./git-checkout-github-pr {};
+  git-diff-word = final: prev: final.callPackage ./git-diff-word {};
+  git-pp = final: prev: final.callPackage ./git-pp {};
+  git-show-link = final: prev: final.callPackage ./git-show-link {};
+  iot-data = final: prev: final.python3.pkgs.callPackage ./iot-data {};
+  nix-remove-result-links = final: prev: final.callPackage ./nix-remove-result-links {};
+  nixfiles-auto-install = final: prev: final.callPackage ./nixfiles/nixfiles-auto-install.nix {};
+  nixfiles-generate-config = final: prev: final.callPackage ./nixfiles/nixfiles-generate-config.nix {};
+  nixfiles-generate-backup-secrets = final: prev: final.callPackage ./nixfiles/nixfiles-generate-backup-secrets.nix {};
+  nixfiles-update-ssh-host-keys = final: prev: final.callPackage ./nixfiles/nixfiles-update-ssh-host-keys.nix {};
+  print-afra = final: prev: final.callPackage ./print-afra {};
+  run-with-docker-group = final: prev: final.callPackage ./run-with-docker-group {};
+  ssh-gpg = final: prev: final.callPackage ./ssh-gpg {};
+  update-from-hydra = final: prev: final.callPackage ./update-from-hydra {};
+  uptimestatus = final: prev: final.python3.pkgs.callPackage ./uptimestatus {};
+
+  xmppc = final: prev: import ./overrides/xmppc.nix final prev;
+}