work on mapping packages
This commit is contained in:
20
flake.nix
20
flake.nix
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user