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

18
flake.lock generated
View File

@@ -37,8 +37,7 @@
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"systems": "systems_2"
"nixpkgs": "nixpkgs"
}
},
"systems": {
@@ -55,21 +54,6 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

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)