2019-12-09 03:40:48 +01:00
|
|
|
# This file sets up the top-level package set by traversing the package tree
|
2021-04-12 21:49:36 +02:00
|
|
|
# (see //nix/readTree for details) and constructing a matching attribute set
|
2019-12-09 03:40:48 +01:00
|
|
|
# tree.
|
2019-06-29 15:12:24 +02:00
|
|
|
|
2022-01-16 13:55:36 +01:00
|
|
|
{ nixpkgsBisectPath ? null
|
|
|
|
, parentTargetMap ? null
|
|
|
|
, nixpkgsConfig ? { }
|
2022-06-03 14:56:36 +02:00
|
|
|
, localSystem ? builtins.currentSystem
|
2023-10-16 15:29:56 +02:00
|
|
|
, crossSystem ? null
|
2022-01-16 13:55:36 +01:00
|
|
|
, ...
|
|
|
|
}@args:
|
2019-12-13 22:32:35 +01:00
|
|
|
|
2019-06-29 15:12:24 +02:00
|
|
|
let
|
2021-04-12 21:49:36 +02:00
|
|
|
inherit (builtins)
|
|
|
|
filter
|
|
|
|
;
|
|
|
|
|
2021-11-23 12:24:58 +01:00
|
|
|
readTree = import ./nix/readTree { };
|
2021-08-26 19:00:03 +02:00
|
|
|
|
2021-11-13 18:25:02 +01:00
|
|
|
# Disallow access to //users from other depot parts.
|
2021-11-23 12:24:58 +01:00
|
|
|
usersFilter = readTree.restrictFolder {
|
2021-11-13 18:25:02 +01:00
|
|
|
folder = "users";
|
|
|
|
reason = ''
|
|
|
|
Code under //users is not considered stable or dependable in the
|
|
|
|
wider depot context. If a project under //users is required by
|
|
|
|
something else, please move it to a different depot path.
|
|
|
|
'';
|
|
|
|
|
|
|
|
exceptions = [
|
|
|
|
# whitby is allowed to access //users for several reasons:
|
|
|
|
#
|
|
|
|
# 1. User SSH keys are set in //users.
|
|
|
|
# 2. Some personal websites or demo projects are served from it.
|
|
|
|
[ "ops" "machines" "whitby" ]
|
|
|
|
|
|
|
|
# Due to evaluation order this also affects these targets.
|
|
|
|
# TODO(tazjin): Can this one be removed somehow?
|
|
|
|
[ "ops" "nixos" ]
|
|
|
|
[ "ops" "machines" "all-systems" ]
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2021-11-13 21:37:43 +01:00
|
|
|
# Disallow access to //corp from other depot parts.
|
2021-11-23 12:24:58 +01:00
|
|
|
corpFilter = readTree.restrictFolder {
|
2021-11-13 21:37:43 +01:00
|
|
|
folder = "corp";
|
|
|
|
reason = ''
|
|
|
|
Code under //corp may use incompatible licensing terms with
|
|
|
|
other depot parts and should not be used anywhere else.
|
|
|
|
'';
|
|
|
|
|
|
|
|
exceptions = [
|
|
|
|
# For the same reason as above, whitby is exempt to serve the
|
|
|
|
# corp website.
|
|
|
|
[ "ops" "machines" "whitby" ]
|
|
|
|
[ "ops" "nixos" ]
|
|
|
|
[ "ops" "machines" "all-systems" ]
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2021-11-23 12:24:58 +01:00
|
|
|
readDepot = depotArgs: readTree {
|
2021-11-13 18:25:02 +01:00
|
|
|
args = depotArgs;
|
|
|
|
path = ./.;
|
2021-11-13 21:37:43 +01:00
|
|
|
filter = parts: args: corpFilter parts (usersFilter parts args);
|
2021-11-13 18:25:02 +01:00
|
|
|
scopedArgs = {
|
|
|
|
__findFile = _: _: throw "Do not import from NIX_PATH in the depot!";
|
2022-11-10 14:44:05 +01:00
|
|
|
builtins = builtins // {
|
|
|
|
currentSystem = throw "Use localSystem from the readTree args instead of builtins.currentSystem!";
|
|
|
|
};
|
2021-08-26 19:00:03 +02:00
|
|
|
};
|
2021-11-13 18:25:02 +01:00
|
|
|
};
|
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.
|
|
|
|
#
|
2023-08-21 23:45:36 +02:00
|
|
|
# Any build target that contains `meta.ci.skip = true` or is marked
|
|
|
|
# broken will be skipped.
|
2020-08-27 01:11:11 +02:00
|
|
|
# Is this tree node eligible for build inclusion?
|
2023-09-06 00:50:15 +02:00
|
|
|
eligible = node: (node ? outPath) && !(node.meta.ci.skip or (node.meta.broken or false));
|
2020-08-27 01:11:11 +02:00
|
|
|
|
2021-11-23 12:39:20 +01:00
|
|
|
in
|
|
|
|
readTree.fix (self: (readDepot {
|
2023-10-16 15:29:56 +02:00
|
|
|
inherit localSystem crossSystem;
|
2021-04-12 21:49:36 +02:00
|
|
|
depot = self;
|
|
|
|
|
|
|
|
# Pass third_party as 'pkgs' (for compatibility with external
|
|
|
|
# imports for certain subdirectories)
|
|
|
|
pkgs = self.third_party.nixpkgs;
|
|
|
|
|
|
|
|
# Expose lib attribute to packages.
|
|
|
|
lib = self.third_party.nixpkgs.lib;
|
|
|
|
|
|
|
|
# Pass arguments passed to the entire depot through, for packages
|
|
|
|
# that would like to add functionality based on this.
|
|
|
|
#
|
|
|
|
# Note that it is intended for exceptional circumstance, such as
|
|
|
|
# debugging by bisecting nixpkgs.
|
|
|
|
externalArgs = args;
|
2021-09-08 17:16:11 +02:00
|
|
|
}) // {
|
2021-04-12 22:26:55 +02:00
|
|
|
# Make the path to the depot available for things that might need it
|
|
|
|
# (e.g. NixOS module inclusions)
|
2021-12-16 17:15:07 +01:00
|
|
|
path = self.third_party.nixpkgs.lib.cleanSourceWith {
|
|
|
|
name = "depot";
|
|
|
|
src = ./.;
|
|
|
|
filter = self.third_party.nixpkgs.lib.cleanSourceFilter;
|
|
|
|
};
|
2020-06-24 04:08:53 +02:00
|
|
|
|
2023-08-21 23:45:36 +02:00
|
|
|
# Additionally targets can be excluded from CI by adding them to the
|
|
|
|
# list below.
|
|
|
|
ci.excluded = [
|
|
|
|
# xanthous and related targets are disabled until cl/9186 is submitted
|
2024-02-12 04:00:40 +01:00
|
|
|
self.users.aspen.xanthous
|
|
|
|
self.users.aspen.system.system.mugwumpSystem
|
2024-03-31 11:56:52 +02:00
|
|
|
|
|
|
|
# Temporarily disabled after cl/11289. Hopefully these failures are transient
|
|
|
|
# and will disappear with the next channel bump.
|
|
|
|
self.users.aspen.system.home.ogopogoHome
|
|
|
|
self.users.aspen.system.home.luscaHome
|
|
|
|
self.users.aspen.system.home.yerenHome
|
|
|
|
self.users.aspen.system.system.roswellSystem
|
|
|
|
self.users.wpcarro.nixos.avaSystem
|
|
|
|
self.users.wpcarro.nixos.kyokoSystem
|
|
|
|
self.users.wpcarro.nixos.marcusSystem
|
|
|
|
self.users.wpcarro.nixos.tarascoSystem
|
2023-08-21 23:45:36 +02:00
|
|
|
];
|
|
|
|
|
2020-08-27 01:11:11 +02:00
|
|
|
# List of all buildable targets, for CI purposes.
|
|
|
|
#
|
2020-08-27 02:05:45 +02:00
|
|
|
# Note: To prevent infinite recursion, this *must* be a nested
|
|
|
|
# attribute set (which does not have a __readTree attribute).
|
2023-08-21 23:45:36 +02:00
|
|
|
ci.targets = readTree.gather
|
|
|
|
(t: (eligible t) && (!builtins.elem t self.ci.excluded))
|
|
|
|
(self // {
|
|
|
|
# remove the pipelines themselves from the set over which to
|
|
|
|
# generate pipelines because that also leads to infinite
|
|
|
|
# recursion.
|
|
|
|
ops = self.ops // { pipelines = null; };
|
|
|
|
});
|
2021-04-11 12:19:18 +02:00
|
|
|
|
|
|
|
# Derivation that gcroots all depot targets.
|
2023-03-08 12:06:03 +01:00
|
|
|
ci.gcroot = with self.third_party.nixpkgs; writeText "depot-gcroot"
|
|
|
|
(builtins.concatStringsSep "\n"
|
|
|
|
(lib.flatten
|
|
|
|
(map (p: map (o: p.${o}) p.outputs or [ ]) # list all outputs of each drv
|
|
|
|
self.ci.targets)));
|
2021-04-12 21:49:36 +02:00
|
|
|
})
|