refactor(flake): discover project packages

This commit is contained in:
2026-09-19 16:28:42 -04:00
parent 95e9ad562e
commit 99f091e92a

View File

@@ -6,13 +6,33 @@
}: }:
let let
pkgs = inputs.nixpkgs.legacyPackages.${system}; pkgs = inputs.nixpkgs.legacyPackages.${system};
packageDirs =
dir:
lib.flatten (
lib.mapAttrsToList (
name: type:
let
path = dir + "/${name}";
in in
{ if type == "directory" then
xatu = import ../xatu/package.nix { packageDirs path
else if type == "regular" && name == "package.nix" then
[ dir ]
else
[ ]
) (builtins.readDir dir)
);
package = dir: {
name = builtins.baseNameOf (toString dir);
value = import (dir + "/package.nix") {
inherit inherit
lib lib
pkgs pkgs
root root
; ;
}; };
} };
in
builtins.listToAttrs (map package (packageDirs (root + "/src")))