work on mapping packages

This commit is contained in:
2025-07-29 12:28:45 +00:00
parent 0c48addc4b
commit 8660752e1b
2 changed files with 19 additions and 19 deletions

View File

@@ -4,7 +4,6 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
systems.url = "github:nix-systems/default";
};
outputs =
@@ -12,7 +11,6 @@
self,
nixpkgs,
flake-utils,
systems,
}:
{
@@ -33,9 +31,27 @@
};
inherit (pkgs) lib;
scope = lib.makeScope pkgs.newScope (final: self.overlays.default (pkgs // final) pkgs);
recursePackage =
name: pkg:
let
isDrv = lib.isDerivation pkg;
isAttrs = lib.isAttrs pkg;
in
if isDrv then
[
(lib.nameValuePair name pkg)
]
else if isAttrs then
lib.mapAttrsToList (nameNew: subPkg: recursePackage "${name}-${nameNew}" subPkg) pkg
else
[ ];
flatPackages = builtins.listToAttrs (
lib.lists.flatten (lib.mapAttrsToList (name: pkg: recursePackage name pkg) scope)
);
workingPackages = lib.filterAttrs (_: pkg: !pkg.meta.broken) self.packages.${system};
in
{
inherit flatPackages;
inherit pkgs;
packages = lib.filterAttrs (
_: pkg: lib.isDerivation pkg && (lib.meta.availableOn pkgs.stdenv.hostPlatform pkg)