all: embrace unit packages where possible
This commit is contained in:
24
flake.nix
24
flake.nix
@ -15,10 +15,28 @@
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
# nixos/rfcs#140
|
||||
# Only produces the package set of the proposed functionality.
|
||||
# Unstable names are variables.
|
||||
packages =
|
||||
lib.filterAttrs
|
||||
(_: drv: builtins.elem system (drv.meta.platforms or [ ]))
|
||||
(import ./pkgs/top-level/all-packages.nix { inherit pkgs; });
|
||||
let
|
||||
unitDir = "unit";
|
||||
packageFun = "package.nix";
|
||||
|
||||
callUnitRoot = root:
|
||||
let
|
||||
shards = lib.attrNames (builtins.readDir root);
|
||||
namesForShard = shard: lib.mapAttrs'
|
||||
(name: _: { inherit name; value = "${root}/${shard}/${name}"; })
|
||||
(builtins.readDir "${root}/${shard}");
|
||||
namesToPath = lib.foldl' lib.recursiveUpdate { } (map namesForShard shards);
|
||||
units = lib.mapAttrs (_: path: pkgs.callPackage "${path}/${packageFun}" { }) namesToPath;
|
||||
in
|
||||
units;
|
||||
legacyPackages = import ./pkgs/top-level/all-packages.nix { inherit pkgs; };
|
||||
onlyAvailable = lib.filterAttrs (_: drv: builtins.elem system (drv.meta.platforms or [ ]));
|
||||
in
|
||||
onlyAvailable (legacyPackages // callUnitRoot "${./pkgs}/${unitDir}");
|
||||
|
||||
checks = {
|
||||
nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" ''
|
||||
|
Reference in New Issue
Block a user