diff options
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 81 |
1 files changed, 28 insertions, 53 deletions
diff --git a/default.nix b/default.nix index c5db0d1e321a..a73e46877ab1 100644 --- a/default.nix +++ b/default.nix @@ -1,53 +1,21 @@ # 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 +# (see //nix/readTree for details) and constructing a matching attribute set # tree. -# -# This makes packages accessible via the Nixery instance that is configured to -# use this repository as its nixpkgs source. { nixpkgsBisectPath ? null, ... }@args: -with builtins; - let + inherit (builtins) + attrValues + concatMap + filter + ; + # 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; - - # Global configuration that all packages are called with. - config = depot: { - inherit depot; - - # Expose lib attribute to packages. - inherit (depot.third_party.nixpkgs) lib; - - # Pass third_party as 'pkgs' (for compatibility with external - # imports for certain subdirectories) - pkgs = depot.third_party.nixpkgs; - - # 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; - }; - readTree' = import ./nix/readTree {}; - localPkgs = readTree: { - fun = readTree ./fun; - lisp = readTree ./lisp; - net = readTree ./net; - nix = readTree ./nix; - ops = readTree ./ops; - third_party = readTree ./third_party; - tools = readTree ./tools; - tvix = readTree ./tvix; - users = readTree ./users; - web = readTree ./web; - }; - # To determine build targets, we walk through the depot tree and # fetch attributes that were imported by readTree and are buildable. # @@ -78,19 +46,30 @@ let }) (node.meta.targets or [])) else []; -in fix(self: { - __readTree = []; - config = config self; - - # Expose readTree for downstream repo consumers. - readTree = { - __functor = x: (readTree' x.config); - config = self.config; - }; # Make the path to the depot available for things that might need it # (e.g. NixOS module inclusions) depotPath = ./.; +in fix(self: (readTree' { + # TODO(tazjin): Settle on one way of using depotPath + inherit depotPath; + 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; +} ./.) // { + inherit depotPath; # List of all buildable targets, for CI purposes. # @@ -111,8 +90,4 @@ in fix(self: { name = "depot-gcroot"; paths = self.ci.targets; }; -} - -# Add local packages as structured by readTree -// (localPkgs (readTree' self.config)) -) +}) |