tools/flake.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

2022-11-25 00:13:47 +03:00
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
let
inherit (builtins) listToAttrs mapAttrs;
mkPackage = pkgs: name: pkgs.callPackage ./pkgs/${name}.nix { };
mkApp = drv: flake-utils.lib.mkApp { inherit drv; };
mkOverlay = name:
final: prev:
final.setAttrByPath [ name ] (mkPackage name prev);
2022-11-30 14:47:18 +03:00
allPackageNames = [ "d2" "d2_unstable" ];
2022-11-25 00:13:47 +03:00
mkAllPackages = pkgs':
listToAttrs
(map
(name: { inherit name; value = mkPackage pkgs' name; })
allPackageNames);
in
{
overlays = (listToAttrs
(map
(name: { inherit name; value = mkOverlay name; })
allPackageNames
)
) // {
all = final: prev: mkAllPackages prev;
};
}
// flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
packages = mkAllPackages pkgs;
in
{
check = packages;
inherit packages;
apps = mapAttrs (name: mkApp) packages;
});
}