2019-12-09 03:40:48 +01:00
|
|
|
# This file sets up the top-level package set by traversing the package tree
|
|
|
|
# (see read-tree.nix for details) and constructing a matching attribute set
|
|
|
|
# tree.
|
2019-08-15 17:07:28 +02:00
|
|
|
#
|
|
|
|
# This makes packages accessible via the Nixery instance that is configured to
|
|
|
|
# use this repository as its nixpkgs source.
|
2019-06-29 15:12:24 +02:00
|
|
|
|
2019-12-13 22:32:35 +01:00
|
|
|
{ ... }@args:
|
|
|
|
|
2019-08-19 03:28:03 +02:00
|
|
|
with builtins;
|
|
|
|
|
2019-06-29 15:12:24 +02:00
|
|
|
let
|
2019-12-09 03:40:48 +01:00
|
|
|
# This definition of fix is identical to <nixpkgs>.lib.fix, but the global
|
|
|
|
# package set is not available here.
|
|
|
|
fix = f: let x = f x; in x;
|
2019-08-25 18:54:17 +02:00
|
|
|
|
2019-12-09 03:40:48 +01:00
|
|
|
# Global configuration that all packages are called with.
|
2020-02-21 13:45:43 +01:00
|
|
|
config = depot: {
|
|
|
|
inherit depot;
|
|
|
|
|
2020-06-24 04:08:53 +02:00
|
|
|
# Expose lib & ciBuilds attributes to packages.
|
|
|
|
inherit (depot) ciBuilds lib;
|
|
|
|
|
2020-02-21 13:45:43 +01:00
|
|
|
# Pass third_party as 'pkgs' (for compatibility with external
|
|
|
|
# imports for certain subdirectories)
|
|
|
|
pkgs = depot.third_party;
|
2019-12-09 03:40:48 +01:00
|
|
|
};
|
|
|
|
|
2019-12-21 06:42:32 +01:00
|
|
|
readTree' = import ./nix/readTree {};
|
2019-12-09 03:40:48 +01:00
|
|
|
|
|
|
|
localPkgs = readTree: {
|
2019-12-21 02:07:29 +01:00
|
|
|
fun = readTree ./fun;
|
2020-06-08 00:50:47 +02:00
|
|
|
lisp = readTree ./lisp;
|
|
|
|
net = readTree ./net;
|
2019-12-21 02:07:29 +01:00
|
|
|
nix = readTree ./nix;
|
|
|
|
ops = readTree ./ops;
|
|
|
|
third_party = readTree ./third_party;
|
|
|
|
tools = readTree ./tools;
|
2020-06-13 22:52:20 +02:00
|
|
|
users = readTree ./users;
|
2019-12-21 02:07:29 +01:00
|
|
|
web = readTree ./web;
|
2019-12-09 03:40:48 +01:00
|
|
|
};
|
2020-08-27 01:11:11 +02:00
|
|
|
|
|
|
|
# To determine build targets, we walk through the depot tree and
|
|
|
|
# fetch attributes that were imported by readTree and are buildable.
|
|
|
|
#
|
|
|
|
# Any build target that contains `meta.ci = false` will be skipped.
|
|
|
|
|
|
|
|
# Is this tree node eligible for build inclusion?
|
|
|
|
eligible = node: (node ? outPath) && (node.meta.ci or true);
|
|
|
|
|
|
|
|
# Walk the tree starting with 'node', recursively extending the list
|
|
|
|
# of build targets with anything that looks buildable.
|
|
|
|
gather = node:
|
|
|
|
if node ? __readTree then
|
|
|
|
(if eligible node then [node] else []) ++
|
|
|
|
concatMap gather (attrValues node)
|
|
|
|
else [];
|
2019-12-09 03:40:48 +01:00
|
|
|
in fix(self: {
|
|
|
|
config = config self;
|
|
|
|
|
|
|
|
# Elevate 'lib' from nixpkgs
|
2019-12-09 03:52:11 +01:00
|
|
|
lib = import (self.third_party.nixpkgsSrc + "/lib");
|
2019-12-16 14:32:10 +01:00
|
|
|
|
|
|
|
# Expose readTree for downstream repo consumers.
|
|
|
|
readTree = {
|
|
|
|
__functor = x: (readTree' x.config);
|
|
|
|
config = self.config;
|
|
|
|
};
|
2020-06-13 22:39:48 +02:00
|
|
|
|
|
|
|
# Make the path to the depot available for things that might need it
|
|
|
|
# (e.g. NixOS module inclusions)
|
|
|
|
depotPath = ./.;
|
2020-06-24 04:08:53 +02:00
|
|
|
|
2020-08-27 01:11:11 +02:00
|
|
|
# List of all buildable targets, for CI purposes.
|
|
|
|
#
|
|
|
|
# Note: This *must* be a nested attribute, otherwise we will get
|
|
|
|
# infinite recursion and everything blows up.
|
|
|
|
ci.targets = gather self;
|
2019-12-09 03:40:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Add local packages as structured by readTree
|
2020-06-24 04:08:53 +02:00
|
|
|
// (localPkgs (readTree' self.config))
|
2019-12-09 03:40:48 +01:00
|
|
|
|
|
|
|
# Load overrides into the top-level.
|
|
|
|
#
|
|
|
|
# This can be used to move things from third_party into the top-level, too (such
|
|
|
|
# as `lib`).
|
2020-02-21 13:45:43 +01:00
|
|
|
// (readTree' { depot = self; pkgs = self.third_party; }) ./overrides
|
2019-12-19 16:35:03 +01:00
|
|
|
)
|