uvms/pkgs/default.nix

32 lines
732 B
Nix
Raw Normal View History

{ lib, newScope }:
let
dirToAttrs = import ../lib/dirToAttrs.nix { inherit lib; };
in
lib.makeScope newScope (
self:
let
callPackage =
fun: overrides:
let
result = self.callPackage fun overrides;
in
result // { override = result.__originalOverride or result.override; };
in
dirToAttrs ./.
[
(
path: fname: _:
if fname == "default.nix" then null else lib.strings.removeSuffix ".nix" fname
)
]
(
name: fpath: typ:
if typ == "regular" then
callPackage fpath { }
else if typ == "directory" && builtins.pathExists (fpath + "/package.nix") then
callPackage (fpath + "/package.nix") { }
else
null
)
)