Commit Graph

425 Commits

Author SHA1 Message Date
John Ericson c38dd73dec
Merge pull request #308032 from obsidiansystems/freebsd-no-suffix-version
treewide: freebsd13 -> freebsd
2024-05-01 10:03:12 -04:00
John Ericson 266cdd7d37 treewide: freebsd13 -> freebsd
Co-authored-by: Alyssa Ross <hi@alyssa.is>
2024-04-30 18:20:23 -04:00
Maximilian Bosch 2b4e18f3d4
nixVersions.unstable: build from master, re-init at 2.22.0.pre20240321_6fd2f42c
The idea behind that is to enable users and developers of
downstream tools such as home-manager to test Nix master for several
reasons:

* Nix is currently trying to have a `master` branch that's always
  releasable[1]. We're still on Nix 2.18 in nixpkgs due to too many
  notable regressions. Enabling people to test latest master may help on
  that end.

* This uses the most bleeding-edge Nix, but our packaging, so we can
  identify issues with our packaging early.

* From what I've seen, most people are using the packages from nixpkgs
  anyways instead of the upstream flake, this is far more convenient
  anyways.

My plan is to update this once a week. Right now we rely on the
`installCheckPhase` here, but as soon as we have proper regression
testing[2], we may want to add `nixUnstable` there as well (however with
failures being allowed probably).

[1] https://discourse.nixos.org/t/nix-release-schedule-and-roadmap/14204
[2] https://github.com/NixOS/nixpkgs/pull/304332
2024-04-28 21:59:04 +02:00
Silvan Mosberger 6861ef7707 lib.lists.ifilter0: init 2024-04-22 18:33:14 +02:00
Gabriel Volpe 7b687a59cd
lib/tests: apply lints 2024-04-15 19:18:41 +02:00
Gabriel Volpe fe2bead78b
lib/attrsets: introduce mapCartesianProduct 2024-04-15 19:16:15 +02:00
Gabriel Volpe 10517cf9ab
tree-wide: use cartesianProduct 2024-04-15 19:13:22 +02:00
Silvan Mosberger 4f1d724b82
Merge pull request #284551 from hercules-ci/types-attrTag
Add `types.attrTag`
2024-04-09 20:48:44 +02:00
Silvan Mosberger a448a21521
Merge pull request #301556 from edef1c/lib-xor
lib: add xor
2024-04-04 22:03:53 +02:00
edef 725bb4e48c lib: add xor
This gets clumsily reimplemented in various places, to no useful end.
2024-04-04 19:46:58 +00:00
Johannes Kirschbauer c0f5f271d1
doc: migrate trivial files to doc-comment format (#299986)
* doc: migrate trivial files to doc-comment format

* fix: revert some comments

* Apply suggestions from code review

Thanks @danielSidhion

Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>

* Update lib/types.nix

---------

Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2024-04-04 16:36:07 +02:00
Robert Hensing 22d7f146a4 lib.types.attrTag: Fix declarationPositions after merge 2024-04-04 12:56:56 +02:00
Robert Hensing cf4968a904 lib/tests/modules/types-attrTag.nix: Test other option doc attrs 2024-04-04 12:22:08 +02:00
Robert Hensing 74831d8b38 lib/tests/modules/types-attrTag.nix: Clean up unneeded comment 2024-04-04 12:00:55 +02:00
Robert Hensing 47e4a18d01 types.attrTagWith: remove
Keep it simple for now.
2024-04-04 12:00:54 +02:00
Robert Hensing 1465777b63 lib.types.attrTag: Custom error when passing bare type 2024-04-04 11:54:46 +02:00
Robert Hensing bcd774606a lib/tests/modules/types-attrTag: Test against unexpected attrs
Thank you lheckemann for pointing this out!
2024-04-04 11:54:46 +02:00
Robert Hensing 475a55b2f0 lib.types.attrTag: Remove tags from description
You can find them in the sub-options now.
2024-04-04 11:54:46 +02:00
Robert Hensing 4c7d990bad lib.types.attrTag: Provide declarations, definitions 2024-04-04 11:54:45 +02:00
Robert Hensing 0bc9783221 lib.types.attrTag: Support type merging 2024-04-04 11:54:45 +02:00
Robert Hensing 42d3b54f0d lib.types.attrTag: Take options instead of types 2024-04-04 11:54:45 +02:00
Robert Hensing 5b49672af4 lib.types.attrTag: Support module docs 2024-04-04 11:54:41 +02:00
Florian Richer 3b883d3cdf
lib/strings: Add makeIncludePath (#296237)
* Update strings.nix

* Fix typo in docs

* Update lib/strings.nix

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>

* Update lib/strings.nix

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>

* Add unit test with strings

* Move test to strings

* Add unit test with package structure

* testMakeIncludePathWithPkgs: use real pkgs

* Revert "testMakeIncludePathWithPkgs: use real pkgs"

This reverts commit fb1850c069cfb324f3a43323da740a27a11793f3.

* Update lib/tests/misc.nix

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>

* Update lib/tests/misc.nix

Co-authored-by: Silvan Mosberger <github@infinisil.com>

---------

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2024-04-02 19:01:05 +02:00
Philip Taron c8a8550c28
Avoid top-level `with` in lib/tests/misc.nix 2024-03-11 16:30:31 -07:00
Philip Taron 20abffc0dd
Avoid top-level `with ...;` in lib/tests/modules/extendModules-168767-imports.nix 2024-03-11 08:38:37 -07:00
Philip Taron 0426125c53
Avoid top-level `with ...;` in lib/tests/modules/alias-with-priority.nix 2024-03-11 08:38:14 -07:00
Philip Taron dd46445adc
Avoid top-level `with ...;` in lib/tests/modules/alias-with-priority-can-override.nix 2024-03-11 08:37:31 -07:00
Silvan Mosberger fc3cc21d2a
Merge pull request #292209 from hercules-ci/lazyDerivation-multi-output
lib.lazyDerivation: Support multi-output derivations
2024-03-06 17:14:33 +01:00
Artturi 961ddd92a1
Merge pull request #177977 from thefloweringash/call-packages-with-function-args
lib/customization: propagate function arguments in callPackagesWith
2024-03-03 21:07:56 +02:00
Robert Hensing 612dcbe11e lib.lazyDerivation: Support multi-output derivations 2024-02-29 12:37:52 +01:00
Andrew Childs 741377b300 lib/customization: propagate function arguments in callPackagesWith
makeOverridable is very careful to ensure the arguments to the
overridden function are the same as the input function. As a result,
the arguments of hello.override are exactly the same as the original
arguments of the hello function that produced the derivation.

However, callPackagesWith calls makeOverridable with a lambda that
does not propagate the arguments. The override function for a package
instantiated with callPackagesWith will not have the original
arguments.

For example:

    nix-repl> lib.functionArgs hello.override
    { callPackage = false; fetchurl = false; hello = false; lib = false; nixos = false; stdenv = false; testers = false; }

    nix-repl> lib.functionArgs openssl.override
    { }

By copying the arguments onto the inner lambda before passing it to
makeOverridable, we can make callPackage and callPackages behave the
same.

    nix-repl> lib.functionArgs openssl.override
    { buildPackages = false; coreutils = false; cryptodev = false; enableSSL2 = true; enableSSL3 = true; fetchurl = false; lib = false; perl = false; removeReferencesTo = false; static = true; stdenv = false; withCryptodev = true; withPerl = true; }
2024-02-28 15:29:08 +02:00
Robert Hensing bb036f2486 lib/tests/release: Test lib.version in isolation 2024-02-26 22:35:14 +01:00
Robert Hensing f45844cb55 .version: Make lib/.version source of truth
This way we don't have to make sure they're in sync, and we remove
a small step from the release process.
2024-02-26 22:34:10 +01:00
Robert Hensing 17117cf565 lib flake: Fix version
Manually tested with

nix-repl> :lf path:lib
nix-repl> lib.version
2024-02-26 22:32:58 +01:00
Robert Hensing 475ee3a18e lib/tests/test-with-nix.nix: init
See https://github.com/NixOS/nix/pull/9900
2024-02-23 11:07:08 +01:00
Robert Hensing ca81a89839 lib.types.attrTag: init 2024-02-11 18:44:52 +01:00
Silvan Mosberger f37ba19765
Merge pull request #284512 from hercules-ci/lib-types-unique-merge
lib.types.unique: Check inner type deeply
2024-02-10 02:52:45 +01:00
Robert Hensing 5d7125e01e
Merge pull request #285612 from hercules-ci/doRename-condition
lib.modules.doRename: Add condition parameter
2024-02-05 19:24:36 +01:00
Silvan Mosberger 27dbf77d62
Merge pull request #285353 from sternenseemann/nix-2.3-syntax
treewide: fix parse errors with Nix 2.3 and related problems
2024-02-05 17:44:28 +01:00
Shea Levy ca1262a483
lib: Add optionalDrvAttr to conditionally set drv attributes.
This allows for adding new, conditionally set, derivation attributes
to an existing derivation without changing any output paths in the
case where the condition is not met.
2024-02-02 16:27:30 -05:00
Robert Hensing 29c7665003 lib.modules.doRename: Add condition parameter
This is to support single-to-multi service migrations, so that the
`to` (e.g. `foos.""`) isn't defined unconditionally. See test cases.
2024-02-02 07:31:16 +01:00
sternenseemann 84a4712bcb lib/tests/packages-from-directory: make sure all .nix files parse
It is useful that all (or almost all) .nix files in nixpkgs at least
parse since it allows for checking syntax in the repository
programmatically without evaluating anything.
2024-01-31 20:30:17 +01:00
Danila Danko 7dea495d34 feat: add test for nonEmptyListOf submodule 2024-01-30 21:32:34 +03:00
Robert Hensing b78ba9bc68 lib.types.unique: Check inner type deeply
This doesn't change uniq. Why not?

- In NixOS it seems that uniq is only used with
  simple types that are fully checked by t.check.

- It exists for much longer and is used more widely.

- I believe we should deprecate it, because unique was
  already better.

- unique can be a proving ground.
2024-01-28 14:09:27 +01:00
Robert Hensing 6f4d0b5261 lib.types: Improve descriptions of composed types that have commas
Type:   either ints.positive (enum ["auto"])
Before: positive integer, meaning >0 or value "auto" (singular enum)
After:  positive integer, meaning >0, or value "auto" (singular enum)
2023-12-23 11:40:27 +01:00
Silvan Mosberger cf47b9a5c0
Merge pull request #270537 from 9999years/packagesFromDirectory
lib.packagesFromDirectoryRecursive: init
2023-12-19 22:03:01 +01:00
Rebecca Turner 090b929b8a
lib.packagesFromDirectoryRecursive: init
Co-authored-by: Gabriella Gonzalez <GenuineGabriella@gmail.com>
2023-12-19 09:48:17 -08:00
Rebecca Turner fa9727cf1e
lib: `modules.sh` should check JSON output for predictability
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-19 09:23:09 -08:00
Adam Joseph 8f34a10d6a lib/tests/release.nix: temporary reference to pkgs/test/release
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-15 05:13:50 -08:00
Robert Hensing 6c8fb49bfc
Merge pull request #273004 from hercules-ci/attrset-path-longest-prefix
lib.attrsets.longestValidPathPrefix: init
2023-12-11 13:25:45 +01:00