nixos-configs/common/pkgs/default.nix
matt1432 20dac8791e
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: limit use of with lib
2024-01-22 11:09:37 -05:00

27 lines
501 B
Nix

{
lib,
pkgs,
...
} @ inputs:
let
inherit (lib) concatMapAttrs filterAttrs mkOption pathExists types;
mkPackage = name: v: {
${name} = pkgs.callPackage ./${name} inputs;
};
rmNotPackage = name: value:
value
== "directory"
&& pathExists ./${name}/default.nix;
packages = filterAttrs rmNotPackage (builtins.readDir ./.);
pkgSet = concatMapAttrs mkPackage packages;
in {
options.customPkgs = mkOption {
type = types.attrs;
};
config.customPkgs = pkgSet;
}