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": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"systems": "systems_2"
} }
}, },
"systems": { "systems": {
@@ -55,21 +54,6 @@
"repo": "default", "repo": "default",
"type": "github" "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", "root": "root",

View File

@@ -4,7 +4,6 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
systems.url = "github:nix-systems/default";
}; };
outputs = outputs =
@@ -12,7 +11,6 @@
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
systems,
}: }:
{ {
@@ -33,9 +31,27 @@
}; };
inherit (pkgs) lib; inherit (pkgs) lib;
scope = lib.makeScope pkgs.newScope (final: self.overlays.default (pkgs // final) pkgs); 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}; workingPackages = lib.filterAttrs (_: pkg: !pkg.meta.broken) self.packages.${system};
in in
{ {
inherit flatPackages;
inherit pkgs; inherit pkgs;
packages = lib.filterAttrs ( packages = lib.filterAttrs (
_: pkg: lib.isDerivation pkg && (lib.meta.availableOn pkgs.stdenv.hostPlatform pkg) _: pkg: lib.isDerivation pkg && (lib.meta.availableOn pkgs.stdenv.hostPlatform pkg)