diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/customisation.nix | 15 | ||||
-rw-r--r-- | lib/sources.nix | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix index cc9a9b1c55d0a..bd7ee3c83b8cf 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -38,12 +38,15 @@ rec { // (drv.passthru or {}) // - (if (drv ? crossDrv && drv ? nativeDrv) - then { - crossDrv = overrideDerivation drv.crossDrv f; - nativeDrv = overrideDerivation drv.nativeDrv f; - } - else { })); + # TODO(@Artturin): remove before release 23.05 and only have __spliced. + (lib.optionalAttrs (drv ? crossDrv && drv ? nativeDrv) { + crossDrv = overrideDerivation drv.crossDrv f; + nativeDrv = overrideDerivation drv.nativeDrv f; + }) + // + lib.optionalAttrs (drv ? __spliced) { + __spliced = {} // (lib.mapAttrs (_: sDrv: overrideDerivation sDrv f) drv.__spliced); + }); /* `makeOverridable` takes a function from attribute set to attribute set and diff --git a/lib/sources.nix b/lib/sources.nix index 9db3d23295421..3ad7dc6335549 100644 --- a/lib/sources.nix +++ b/lib/sources.nix @@ -166,7 +166,7 @@ let in type == "directory" || lib.any (ext: lib.hasSuffix ext base) exts; in cleanSourceWith { inherit filter src; }; - pathIsGitRepo = path: (commitIdFromGitRepoOrError path)?value; + pathIsGitRepo = path: (_commitIdFromGitRepoOrError path)?value; /* Get the commit id of a git repo. @@ -174,17 +174,16 @@ let Example: commitIdFromGitRepo <nixpkgs/.git> */ commitIdFromGitRepo = path: - let commitIdOrError = commitIdFromGitRepoOrError path; + let commitIdOrError = _commitIdFromGitRepoOrError path; in commitIdOrError.value or (throw commitIdOrError.error); - /* - Get the commit id of a git repo. + # Get the commit id of a git repo. - Returns `{ value = commitHash }` or `{ error = "... message ..." }`. + # Returns `{ value = commitHash }` or `{ error = "... message ..." }`. - Example: commitIdFromGitRepo <nixpkgs/.git> - */ - commitIdFromGitRepoOrError = + # Example: commitIdFromGitRepo <nixpkgs/.git> + # not exported, used for commitIdFromGitRepo + _commitIdFromGitRepoOrError = let readCommitFromFile = file: path: let fileName = path + "/${file}"; packedRefsName = path + "/packed-refs"; |