summaryrefslogtreecommitdiffstats
path: root/pkgs/default.nix
blob: bc7d70e7840ef13bba917facdb52bbd855b7c0c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
  unstable_pkgs,
  stable_pkgs,
  extra_lib,
}: let
  inherit (unstable_pkgs) lib;

  mergePkgs = pkgs: lib.callPackageWith (extra_lib.warnMerge pkgs in_tree_pkgs "the ./pkgs/by-name set");
  callPackageStable = mergePkgs stable_pkgs;
  callPackageUnstable = mergePkgs unstable_pkgs;

  in_tree_pkgs = extra_lib.mkByName {
    baseDirectory = ./by-name;
    fileRegex = "package.(stable|unstable).nix";
    finalizeFunction = name: pkgPathList: let
      # When specifying a regex `mkByName` returns a list of candidates.
      # But we know, that there can only be one.
      pkgPath = builtins.head pkgPathList;
    in
      if (builtins.match "(stable)" (builtins.baseNameOf pkgPath)) == ["stable"]
      then callPackageStable pkgPath {}
      else callPackageUnstable pkgPath {};
  };
in
  in_tree_pkgs