refactor(readTree): Move copy of 'fix' into readTree

This is often used when bootstrapping a repository with readTree,
before lib is available. Having this definition in readTree is more
convenient than copy&pasting it around to callsites.

Change-Id: I6d5d27ed142bea704843fe289ad2674be8c4d360
This commit is contained in:
Vincent Ambo 2021-11-23 14:39:20 +03:00 committed by tazjin
parent 18c248547d
commit a2be05faa4
2 changed files with 8 additions and 5 deletions

View file

@ -10,10 +10,6 @@ let
filter 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;
readTree = import ./nix/readTree {}; readTree = import ./nix/readTree {};
# Disallow access to //users from other depot parts. # Disallow access to //users from other depot parts.
@ -97,7 +93,7 @@ let
(node.meta.targets or [])) (node.meta.targets or []))
else []; else [];
in fix(self: (readDepot { in readTree.fix(self: (readDepot {
depot = self; depot = self;
# Pass third_party as 'pkgs' (for compatibility with external # Pass third_party as 'pkgs' (for compatibility with external

View file

@ -169,4 +169,11 @@ in {
''; '';
}; };
}; };
# This definition of fix is identical to <nixpkgs>.lib.fix, but is
# provided here for cases where readTree is used before nixpkgs can
# be imported.
#
# It is often required to create the args attribute set.
fix = f: let x = f x; in x;
} }