diff --git a/lib/default.nix b/lib/default.nix index 1bfd5b9ac8b1..15949d1cdf36 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -105,12 +105,14 @@ let # network network = callLibs ./network; + # flakes + flakes = callLibs ./flakes.nix; + inherit (builtins) getContext hasContext convertHash hashString - hasFile parseDrvName placeholder fromJSON @@ -391,6 +393,8 @@ let toInt toIntBase10 fileContents + appendContext + unsafeDiscardStringContext ; inherit (self.stringsWithDeps) textClosureList @@ -415,7 +419,13 @@ let renameCrossIndexTo mapCrossIndex ; - inherit (self.derivations) lazyDerivation optionalDrvAttr warnOnInstantiate; + inherit (self.derivations) + lazyDerivation + optionalDrvAttr + warnOnInstantiate + addDrvOutputDependencies + unsafeDiscardOutputDependency + ; inherit (self.generators) mkLuaInline; inherit (self.meta) addMetaAttrs @@ -443,6 +453,9 @@ let dirOf isPath packagesFromDirectoryRecursive + hashFile + readDir + readFileType ; inherit (self.sources) cleanSourceFilter @@ -593,6 +606,10 @@ let inherit (self.network.ipv6) mkEUI64Suffix ; + inherit (self.flakes) + parseFlakeRef + flakeRefToString + ; } ); in diff --git a/lib/derivations.nix b/lib/derivations.nix index da5621c8f0b3..b092bd3b6f98 100644 --- a/lib/derivations.nix +++ b/lib/derivations.nix @@ -21,6 +21,11 @@ let if pkg ? meta.position && isString pkg.meta.position then "${prefix}${pkg.meta.position}" else ""; in { + inherit (builtins) + addDrvOutputDependencies + unsafeDiscardOutputDependency + ; + /** Restrict a derivation to a predictable set of attribute names, so that the returned attrset is not strict in the actual derivation, diff --git a/lib/filesystem.nix b/lib/filesystem.nix index 7063abfe2079..98a8862d60b8 100644 --- a/lib/filesystem.nix +++ b/lib/filesystem.nix @@ -31,6 +31,12 @@ in isPath ; + inherit (builtins) + readDir + readFileType + hashFile + ; + /** The type of a path. The path needs to exist and be accessible. The result is either `"directory"` for a directory, `"regular"` for a diff --git a/lib/flakes.nix b/lib/flakes.nix new file mode 100644 index 000000000000..755f75b3ebb6 --- /dev/null +++ b/lib/flakes.nix @@ -0,0 +1,12 @@ +/** + Flake operations. +*/ +{ lib }: +{ + + inherit (builtins) + parseFlakeRef + flakeRefToString + ; + +} diff --git a/lib/strings.nix b/lib/strings.nix index cd0027e1a165..3e7f16b48af0 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -39,6 +39,7 @@ rec { toJSON typeOf unsafeDiscardStringContext + appendContext ; /**