From 30ca7034760ebb272681e89355d556d4c13165c3 Mon Sep 17 00:00:00 2001
From: Andrea Ciceri <andrea.ciceri@autistici.org>
Date: Fri, 26 Jan 2024 15:01:59 +0100
Subject: [PATCH] Remove `llm-workflow-engine` derivation fro `aarch64-linux`

---
 packages/default.nix | 78 +++++++++++++++++++++++++-------------------
 1 file changed, 45 insertions(+), 33 deletions(-)

diff --git a/packages/default.nix b/packages/default.nix
index d551653..d501506 100644
--- a/packages/default.nix
+++ b/packages/default.nix
@@ -5,27 +5,37 @@
   self,
   ...
 }: {
-  options.fleet.overlays = let
-    overlayType = lib.mkOptionType {
-      name = "nixpkgs-overlay";
-      description = "nixpkgs overlay";
-      check = lib.isFunction;
-      merge = lib.mergeOneOption;
-    };
-  in
-    lib.mkOption {
-      description = "Nixpkgs overlays to apply at flake level (not in hosts)";
-      type = lib.types.listOf overlayType;
-      default = with inputs; [
-        agenix.overlays.default
-        nur.overlay
-        (final: _: {
-          inherit (disko.packages.${final.system}) disko;
-          inherit (self.packages.${final.system}) deploy;
-          inherit (self.packages.${final.system}) llm-workflow-engine;
-        })
-      ];
+  options.fleet = {
+    overlays = let
+      overlayType = lib.mkOptionType {
+        name = "nixpkgs-overlay";
+        description = "nixpkgs overlay";
+        check = lib.isFunction;
+        merge = lib.mergeOneOption;
+      };
+    in
+      lib.mkOption {
+        description = "Nixpkgs overlays to apply at flake level (not in hosts)";
+        type = lib.types.listOf overlayType;
+        default = with inputs; [
+          agenix.overlays.default
+          nur.overlay
+          (final: _: {
+            inherit (disko.packages.${final.system}) disko;
+            inherit (self.packages.${final.system}) deploy;
+            inherit (self.packages.${final.system}) llm-workflow-engine;
+          })
+        ];
+      };
+    brokenPackages = lib.mkOption {
+      description = "Packages that are broken on a given system";
+      type = lib.types.attrsOf (lib.types.listOf lib.types.str);
+      default = {
+        aarch64-linux = ["llm-workflow-engine"];
+        x86_64-linux = [];
+      };
     };
+  };
 
   config.perSystem = {
     system,
@@ -40,18 +50,20 @@
       config.fleet.overlays;
 
     packages =
-      lib.mapAttrs'
-      (name: value: {
-        inherit name;
-        value = pkgs.callPackage "${self}/packages/${name}" {
-          pkgsStable = inputs.nixpkgsStable.legacyPackages.${system};
-          dream2nix = inputs.dream2nix;
-          projectRoot = self.outPath;
-          packagePath = "packages/${name}";
-        };
-      })
-      (lib.filterAttrs
-        (_: type: type == "directory")
-        (builtins.readDir "${self}/packages"));
+      builtins.removeAttrs
+      (lib.mapAttrs'
+        (name: value: {
+          inherit name;
+          value = pkgs.callPackage "${self}/packages/${name}" {
+            pkgsStable = inputs.nixpkgsStable.legacyPackages.${system};
+            dream2nix = inputs.dream2nix;
+            projectRoot = self.outPath;
+            packagePath = "packages/${name}";
+          };
+        })
+        (lib.filterAttrs
+          (_: type: type == "directory")
+          (builtins.readDir "${self}/packages")))
+      config.fleet.brokenPackages.${system};
   };
 }