summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/default.nix
blob: 6fa93e1460b5d3dc0348a6db5e9ea229bdbe4b38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
self: super: let
  lib = super.lib;

  # This callPackage will try to detect obsolete overrides.
  callPackage = path: args: let
    override =  super.callPackage path args;
    upstream = lib.optionalAttrs (override ? "name")
      (super.${(builtins.parseDrvName override.name).name} or {});
  in if upstream ? "name" &&
        override ? "name" &&
        builtins.compareVersions upstream.name override.name != -1
    then
      builtins.trace
        "Upstream `${upstream.name}' gets overridden by `${override.name}'."
        override
    else override;

   subdirsOf = path:
     lib.mapAttrs (name: _: path + "/${name}")
              (lib.filterAttrs (_: x: x == "directory") (builtins.readDir path));

in lib.mapAttrs (_: lib.flip callPackage {})
            (lib.filterAttrs (_: dir: lib.pathExists (dir + "/default.nix"))
                         (subdirsOf ./.))