This repository has no description
1.0 kB
28 lines
1{ ... }:
2{
3 perSystem =
4 { lib, pkgs, ... }:
5 {
6 packages =
7 let
8 allPackages = lib.mapAttrs (
9 name: _:
10 let
11 pkgDir = ./. + "/${name}";
12 hasPackageNix = builtins.pathExists (pkgDir + "/package.nix");
13 hasDefaultNix = builtins.pathExists (pkgDir + "/default.nix");
14 in
15 if hasPackageNix then
16 pkgs.callPackage (pkgDir + "/package.nix") { }
17 else if hasDefaultNix then
18 builtins.trace "Warning: ${name} is using deprecated default.nix, please rename to package.nix" (
19 pkgs.callPackage pkgDir { }
20 )
21 else
22 throw "Package ${name} has neither package.nix nor default.nix"
23 ) (lib.filterAttrs (_n: v: v == "directory") (builtins.readDir ./.));
24 in
25 # Filter packages based on meta.platforms
26 lib.filterAttrs (_name: pkg: lib.meta.availableOn pkgs.stdenv.hostPlatform pkg) allPackages;
27 };
28}