Tiny helper for dendritic flake-parts setups.
Implements @mightyiam's dendritic guidance for interspersed pkgs.callPackage files: keep package files next to module files, exclude them from auto-import with *.pkg.nix, expose them as perSystem.packages.
Loads *.pkg.nix.
Mapping:
nix/default.pkg.nix->packages.<system>.defaultnix/a/default.pkg.nix->packages.<system>.anix/a/b.pkg.nix->packages.<system>.b
Duplicate package names throw at eval time.
Consume repo as non-flake input.
Import callpackage-tree manually.
{
inputs.callpackage-tree = {
url = "github:bitbloxhub/callpackage-tree";
flake = false;
};
outputs = inputs@{ flake-parts, callpackage-tree, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
(import callpackage-tree {
root = ./nix;
})
];
};
}Exclude *.pkg.nix from your normal dendritic/import-tree module auto-imports, eg with .filterNot (inputs.nixpkgs.lib.hasSuffix ".pkg.nix").
Each discovered package file gets:
{
inputs,
inputs',
self,
self',
# Regular callPackage args
...
}Options:
root: dir to scansuffix: package suffix, default".pkg.nix"