about summary refs log tree commit diff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2023-12-19Merge pull request #272083 from tweag/lib-contribSilvan Mosberger1-0/+63
lib: Add contribution guidelines
2023-12-19Merge pull request #273893 from tweag/fileset.gitTracked-storeDirSilvan Mosberger3-57/+125
`lib.fileset.gitTracked`: Support out-of-tree builds
2023-12-19Remove --simulate-pure-evalSilvan Mosberger1-36/+18
2023-12-19lib.fileset.gitTracked: Support out-of-tree buildsSilvan Mosberger3-6/+86
2023-12-19Merge pull request #270537 from 9999years/packagesFromDirectorySilvan Mosberger14-1/+205
lib.packagesFromDirectoryRecursive: init
2023-12-19lib.packagesFromDirectoryRecursive: initRebecca Turner14-1/+205
Co-authored-by: Gabriella Gonzalez <GenuineGabriella@gmail.com>
2023-12-19lib: `modules.sh` should check JSON output for predictabilityRebecca Turner4-17/+24
Currently, the `lib/tests/modules.sh` test checks the output of `nix-instantiate --eval` without `--json`, which outputs an unspecified human-readable format. This patch modifies `modules.sh` to use the `--json` output instead, to be robust against future changes to `nix-instantiate` output.
2023-12-19lib.fileset.fetchGit: RefactoringSilvan Mosberger1-18/+24
2023-12-15lib.generators: made toLua accept derivations tooMatthieu Coudron1-0/+2
While trying to extend generateLuarocksConfig, I had infinite loops caused by toLua considering derivations as attrSets
2023-12-15lib/tests/release.nix: temporary reference to pkgs/test/releaseAdam Joseph1-1/+13
This commit temporarily adds pkgs/test/release to the lib/tests/release.nix test suite, because ofborg already knows about that entry point. We should move the list of test entry points out of ofborg and into a central place in nixpkgs: https://github.com/NixOS/nixpkgs/issues/272591 Once we do that we won't need to have this ugly kludge in an inappropriate place.
2023-12-15treewide: add __attrsFailEvaluation and __recurseIntoDerivationForReleaseJobsAdam Joseph1-0/+1
2023-12-13Merge pull request #269551 from tejing1/nixos-stub-ldRobert Hensing1-0/+7
nixos/stub-ld: init module
2023-12-13Merge pull request #273704 from adisbladis/lib-getexe-efficiencySilvan Mosberger1-19/+15
lib.getExe: Make more efficient
2023-12-13Merge pull request #274022 from hercules-ci/doc-attrsets-operatorsSilvan Mosberger1-0/+24
lib/attrsets: Document and link Nix language operators
2023-12-13lib/attrsets: Document and link Nix language operatorsRobert Hensing1-0/+24
2023-12-13lib.path.hasStorePathPrefix: initSilvan Mosberger2-1/+110
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-13Merge pull request #273664 from tweag/fileset.gitTracked-improvementsSilvan Mosberger3-41/+56
`lib.fileset.gitTracked,gitTrackedWith`: Minor improvements
2023-12-12lib.getExe: Make more efficientadisbladis1-19/+15
2023-12-11lib.fileset.gitTracked: Improve error when passing filesSilvan Mosberger2-0/+8
2023-12-11lib.fileset: Refactor gitTracked and gitTrackedWithSilvan Mosberger2-41/+48
Introduce an internal function for them to share more behavior. This makes future changes easier.
2023-12-11Merge pull request #273473 from adisbladis/lib-isConvertibleToString-static-listSilvan Mosberger1-2/+4
lib.isConvertibleToString: Statically compute types list
2023-12-11Merge pull request #273470 from adisbladis/lib-tohexstring-static-valuesSilvan Mosberger1-16/+14
lib.toHexString: Statically compute hexDigits attrset
2023-12-11Merge pull request #273474 from adisbladis/lib-cmakeOptionType-static-listSilvan Mosberger1-6/+7
lib.cmakeOptionType: Statically compute types list
2023-12-11Merge pull request #273467 from adisbladis/lib-pipe-no-letSilvan Mosberger1-3/+1
lib.pipe: Avoid creating a scope
2023-12-11Merge pull request #273004 from hercules-ci/attrset-path-longest-prefixRobert Hensing2-0/+117
lib.attrsets.longestValidPathPrefix: init
2023-12-11Merge pull request #257100 from Ma27/version-info-libRobert Hensing3-3/+40
flake: fix `lib.trivial.version` when used from a flake
2023-12-11lib.cmakeOptionType: Statically compute types listadisbladis1-6/+7
2023-12-11lib.isConvertibleToString: Statically compute types listadisbladis1-2/+4
2023-12-11lib.toHexString: Statically compute hexDigits attrsetadisbladis1-16/+14
2023-12-11lib.pipe: Avoid creating scopesadisbladis1-3/+1
2023-12-11lib.strings: Dont create scopes for getName/getVersionadisbladis1-12/+12
We can create the `parse` function in a scope one level up to avoid recomputing it every time.
2023-12-10Merge pull request #272709 from hercules-ci/module-system-test-pr-131205Maximilian Bosch4-0/+36
lib/modules: Test optionless module errors from #131205
2023-12-10flake/version overlay: review fixesMaximilian Bosch3-19/+22
* Improves the comments of `lib/flake-version-info.nix` and drops the `__`-prefix from the filename. * `lib'` -> `lib0` in `nixpkgs/lib`. * Drop the declaration of `trivial.version` in the overlay because this declaration already uses the final expressions of `versionSuffix` and `release` now. * No need to fall back to `self.lastModified` anymore, this was a workaround for pre2.4 Nix. Co-authored-by: Robert Hensing <robert@roberthensing.nl> Co-authored-by: Silvan Mosberger <contact@infinisil.com>
2023-12-10lib/trivial: drop `rec` in favor of `lib` fixpointMaximilian Bosch1-2/+14
That way each expression uses the final version of other lib.trivial declarations. For instance, when replacing `versionSuffix` with the string `"fnord"` in a lib overlay, `trivial.version` uses `"fnord"` as suffix now rather than `pre-git`.
2023-12-10Merge pull request #272183 from infinisil/nixpkgs-referenceRobert Hensing1-1/+1
doc: Rename to Nixpkgs reference manual and restate purpose
2023-12-10Merge pull request #272764 from tweag/anyBoolRobert Hensing3-0/+36
lib.types.anyBool: init
2023-12-09lib/modules: Clarify test assertionsRobert Hensing1-0/+3
2023-12-09lib/modules: Test optionless module errors from #131205Robert Hensing4-0/+33
2023-12-09flake: also provide proper version info for lib's flakeMaximilian Bosch2-1/+23
This effectively means that nixpkgs$ nix eval ./lib#lib.trivial.version "23.11.20231020.ee0d6b5" now gives meaningful results as well. See https://github.com/NixOS/nixpkgs/pull/257100#discussion_r1352075369 for the discussion around this.
2023-12-08lib.attrsets.hasAttrByPath: Document law and laziness, and test itRobert Hensing2-0/+12
2023-12-08lib.attrsets.longestValidPathPrefix: initRobert Hensing2-0/+105
Allows finding the most specific path that exists. This is useful for error messages relating to attribute paths.
2023-12-08lib.sort: Make doc consistent with sortOnRobert Hensing1-1/+4
2023-12-08lib.callPackageWith: Optimize levenshtein sortRobert Hensing1-2/+2
Probably not significant because of the limits already applied. This is mostly cleanup.
2023-12-08lib.sortOn: initRobert Hensing3-1/+63
A more efficient sort in some cases, and often convenient. This exposes `lib.lists.sortOn` immediately on `lib`, because it is a sibling of `sort`, which is already present there. Omitting it would lead to more confusion, and worse outcomes. There's no confusion about the types `sort` or `sortOn` operate on. Haskell agrees about the type for `sortOn`, and it is in its `base`.
2023-12-08lib.types.boolByOr: initSilvan Mosberger3-0/+36
This type is necessary to have correct merging behavior for `allowUnfreePredicate` and `allowInsecurePredicate` Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-08doc: Rename to Nixpkgs reference manual and state purposeSilvan Mosberger1-1/+1
For the time being, we're moving towards https://nix.dev/ containing all tutorials and guides. The Nixpkgs manual is reinforced to be a _reference_ manual. While it's not just reference for now, that's what the docs team is working towards. This commits rewrites the Nixpkgs manual introduction to reflect that and point to some more useful links. The contribution docs are updated similarly so it's not missed. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-05lib: Add contribution guidelinesSilvan Mosberger1-0/+63
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2023-12-03lib.systems.elaborate: add libDir attributeJeff Huffman1-0/+7
2023-12-03lib/customisation: fix eval error (attribute "levenshtein" missing)Someone Serge1-2/+2
2023-12-03lib.systems.elaborate: fix passing `rust` (more) (#271707)Alyssa Ross1-1/+2
An important idea around the rust stuff in lib.systems is that it's elaborated — this means that it should idempotently add to the values passed in, if any. But we missed that the names used for the parameter and the elaborated value for "rustcTarget"/"config" didn't line up. The intention was to use "rustcTarget" everywhere in the new interface, as a more descriptive name than "config". This fixes setting the system in NixOS configuration, which results in an already elaborated system being elaborated again. Before, this wouldn't produce the correct result: % nix-instantiate --eval -A stdenv.hostPlatform.rust.rustcTarget --system armv7l-linux "armv7-unknown-linux-gnueabihf" % NIX_PATH= nix-instantiate --eval -E '(import nixos/lib/eval-config.nix { system = "armv7l-linux"; modules = []; }).pkgs.stdenv.hostPlatform.rust.rustcTarget' "arm-unknown-linux-gnueabihf" Fixes: e3e57b8f1885 ("lib.systems: elaborate Rust metadata") Fixes: https://github.com/NixOS/nixpkgs/issues/271000