Commit Graph

3680 Commits

Author SHA1 Message Date
Silvan Mosberger
b04b7d64f7
Merge pull request #239722 from Stunkymonkey/lib-allUnique
lib.lists.allUnique: init
2023-11-15 04:37:39 +01:00
Silvan Mosberger
7e533bab6d
Merge pull request #267381 from tweag/fileset.fileFilter-path
`fileset.fileFilter`: Don't run predicate unnecessarily
2023-11-15 01:19:36 +01:00
Felix Buehler
66261e9961 lib.lists.allUnique: init 2023-11-14 19:52:32 +01:00
Silvan Mosberger
e89ad83555
Merge pull request #263059 from DanielSidhion/add-doc-convention
doc: commit header convention for documentation changes
2023-11-14 08:11:41 +01:00
Silvan Mosberger
2035f8a324 lib.fileset.fileFilter: Don't run predicate unnecessarily
Before:

    nix-repl> fileset.trace (fileset.fileFilter (file: builtins.trace file.name false) ./default.nix)
    trace: README.md
    trace: benchmark.sh
    trace: default.nix
    trace: internal.nix
    trace: mock-splitRoot.nix
    trace: tests.sh

After:

    nix-repl> fileset.trace (fileset.fileFilter (file: builtins.trace file.name false) ./default.nix)
    trace: default.nix
2023-11-14 07:30:16 +01:00
Silvan Mosberger
e1d8331738 lib.fileset.fileFilter: Minor cleanups and more tests 2023-11-14 07:29:57 +01:00
DS
e93a3d7b58 doc: separate commit header conventions for each area, info on docs changes. 2023-11-13 20:41:08 -08:00
Silvan Mosberger
7eddbf5690
Merge pull request #265710 from ShamrockLee/lib-copy-function-args
lib.mirrorFunctionArgs: init
2023-11-14 05:33:40 +01:00
Silvan Mosberger
9ec104bb2d lib.fileset: Very minor changes 2023-11-13 23:57:52 +01:00
Anthony Roussel
e30f48be94
treewide: fix redirected and broken URLs
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-11-11 10:49:01 +01:00
Robert Hensing
cfd83c931f
Merge pull request #261732 from tweag/fileset.fromSource
`lib.fileset.fromSource`: init
2023-11-10 20:32:51 +01:00
Silvan Mosberger
187c04f19c
Merge pull request #266349 from tweag/fileset/cleanups
Minor `lib.fileset` cleanups
2023-11-09 19:58:16 +01:00
Profpatsch
2099ebdf59 lib: add asserts.assertEachOneOf
Along the lines of `assertOneOf`, but expects a list of values to be
compared. This gives a good error message and is useful for lists of
values, like `supportedGhcVersions` in the arguments of
`haskell-language-server`.
2023-11-09 17:27:20 +01:00
Silvan Mosberger
9cbd394aa0 lib.fileset: Remove unused bindings
Thanks nixd!
2023-11-09 00:02:43 +01:00
Silvan Mosberger
0ace383438 lib.fileset: Make error messages more uniform
Just minor changes like:
- Always using "X is a Y, but it should be Z"
- "X is a path that does not exist" rather than "X does not exist"
- Always using multi-line strings for errors
- Always quoting string-like values and not quoting path-like values
  - But do quote filesystem roots. Even though they're paths, they might
    be very small, good to have quotes to know the start/end
- Capitalise the first word
- Distinguish root vs filesystem root more
2023-11-08 23:59:04 +01:00
Silvan Mosberger
2d28e0cd10 lib.fileset: Remove nixdoc workaround
This problem was fixed in https://github.com/nix-community/nixdoc/pull/81 which is included in version 2.5.1, which is now used in Nixpkgs
2023-11-08 23:28:25 +01:00
Someone Serge
dd8e4b0a02 lib.licenses: nvidia*: add shortName-s 2023-11-08 19:06:44 -03:00
Someone Serge
6cd3e9ce1a cudaPackages: redist components: per-package license url 2023-11-08 19:06:44 -03:00
Someone Serge
6c9c9ef2eb lib.licenses: nvidia*: use same fullNames as conda does 2023-11-08 19:06:44 -03:00
Tyler Benster
75254979ac cudnn_cudatoolkit: add NVIDIA license 2023-11-08 19:06:44 -03:00
Tyler Benster
3d1d5533f8 lib.licenses: add NVIDIA licenses 2023-11-08 19:06:44 -03:00
Silvan Mosberger
e07e80e841 lib.fileset.toSource: Mention fromSource in errors 2023-11-08 21:44:44 +01:00
Silvan Mosberger
73493584a7 lib.fileset.fromSource: init 2023-11-08 21:21:30 +01:00
Silvan Mosberger
f82a1686e6 lib.fileset: Split out internal test helper 2023-11-08 05:18:10 +01:00
Silvan Mosberger
17012aa0d2
Merge pull request #261676 from h7x4/lib-add-replicatestring
lib.strings: add `replicate`
2023-11-07 18:29:31 +01:00
Yueh-Shun Li
6a8b6b8f72 lib.makeOverridable: simplify function arguments preservation
Rename temporary variable copyArgs -> mirrorArgs.
Use lib.mirrorFunctionArgs to define `mirrorArgs`.
Apply mirrorArgs also to the returned function.
2023-11-07 01:58:48 +00:00
Yueh-Shun Li
a16319908e lib.mirrorFunctionArgs: init
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2023-11-07 01:58:04 +00:00
Adam Joseph
8c0416ef36 lib.systems.inspect: add patternLogicalAnd 2023-11-05 00:55:16 +00:00
Artturi
feaa219f39
Merge pull request #265045 from Artturin/addcomment1 2023-11-04 23:00:22 +02:00
Adam Joseph
72c279f477 lib.systems, test.cross.sanity: add test case for #264989
We have several cross-compilation bugs that show up if
hostPlatform!=buildPlatform yet
hostPlatform.config==buildPlatform.config.

These bugs have appeared and disappeared as we've fiddled with the
definition of equality for platform objects.  This commit adds a
clear-cut case where they are *not* equal and never will be, so we
can test it.
2023-11-04 05:57:34 +00:00
Silvan Mosberger
a10c122546
Merge pull request #264892 from tweag/fileset-store-path-rationale
lib.fileset: Add an additional argument in the design docs
2023-11-02 17:51:52 +01:00
Artturin
dd48cb0b34 lib.makeScopeWithSplicing': add comments
I didn't add these arguments, so these comments are from my understading of the arguments.
2023-11-02 17:47:02 +02:00
Silvan Mosberger
2312523ab3 lib.fileset: Add an additional argument in the design docs 2023-11-01 22:38:48 +01:00
Eelco Dolstra
9ec80ed610
Merge pull request #264860 from tweag/filesystem-error-test
lib.filesystem: Don't test Nix-specific error messages
2023-11-01 20:21:44 +01:00
Silvan Mosberger
fc28c5e5b7
Merge pull request #259065 from tweag/fileset.difference
`lib.fileset.difference`: init
2023-11-01 19:40:45 +01:00
Silvan Mosberger
add254658a lib.filesystem: Don't test Nix-specific error messages
In https://github.com/NixOS/nix/pull/9269 the error messages change
which would've broken this test.
2023-11-01 18:56:03 +01:00
h7x4
206d20426c
lib.strings: add replicate
`strings.replicate` returns n copies of a string, concatenated into a new
string

Co-authored-by: Silvan Mosberger <github@infinisil.com>
2023-10-31 20:25:41 +01:00
Alexander Groleau
b7e69faf1d
lib/fixed-points.nix: correct typo
Corrects a minor typo in the description of `fix`; namely that `fix` allows factoring out syntactic recursion from another function.
2023-10-31 11:45:51 -07:00
Silvan Mosberger
e55ee23bf6
Merge pull request #260971 from Gerg-L/getExe
lib.getExe': check arguments
2023-10-31 17:29:15 +01:00
Robert Hensing
1c92b1f03b
Merge pull request #263478 from tweag/fileset/unknown-type-error
`lib.fileset.toSource`: Improve error for unknown file types
2023-10-30 13:14:22 +01:00
Silvan Mosberger
50df7f9775 lib.fileset.difference: init 2023-10-30 12:51:55 +01:00
Silvan Mosberger
47c81d3286 lib.fileset.toSource: Optimise unknown file type error
Compared to the parent commit, this removes any detectable performance
cost :)
2023-10-30 12:48:13 +01:00
Silvan Mosberger
0f6cc8018c lib.fileset.toSource: Improve error for unknown file types
This does decrease performance unfortunately

Benchmarking expression toSource { root = ./.; fileset = ./.; }
Mean CPU time 0.103747 (σ = 0.012415) for 10 runs is 97.32181384964636% (σ = 16.34179537413021%) of the old value 0.106602 (σ = 0.0125571)
Statistic .envs.elements (205920) is 105.5842% (+10891) of the old value 195029
Statistic .gc.totalBytes (20247696) is 101.7495% (+348160) of the old value 19899536
Statistic .nrThunks (134824) is 108.7878% (+10891) of the old value 123933
Statistic .symbols.number (996) is 100.1005% (+1) of the old value 995
Statistic .values.number (275238) is 104.1199% (+10891) of the old value 264347
2023-10-30 12:48:11 +01:00
Silvan Mosberger
88f736f871 lib.fileset.toSource: Test with unknown file type
Currently just throws the Nix error because unknown file types are not
supported by the Nix store, but nothing catches this error earlier (yet,
see next commit)
2023-10-26 01:57:22 +02:00
Silvan Mosberger
7227cb1d73 lib.fileset: Fix shellcheck warnings in tests 2023-10-26 01:51:15 +02:00
John Ericson
791c147cc2
Merge pull request #262838 from amjoseph-nixpkgs/pr/lib/systems/abi-suffix
lib/systems/parse.nix: add removeAbiSuffix, use it
2023-10-25 16:47:31 -04:00
Robert Hensing
185acbce7d
Merge pull request #260265 from tweag/fileset.fileFilter
`lib.fileset.fileFilter`: init
2023-10-24 11:29:57 +02:00
Silvan Mosberger
f4e0043049 lib.fileset.fileFilter: init 2023-10-24 01:44:04 +02:00
Adam Joseph
20b62456f0 lib/systems/parse.nix: add, use removeAbiSuffix
gnu-config will ignore the portion of a triple matching the regex
`e?abi.*$` when determining the validity of a triple.  In other
words, `i386-linuxabichickenlips` is a valid triple.

This commit updates our parsing routines to match gnu-config.

I was recently surprised to discover that it is in fact possible to
shoehorn ABI flavors into nix doubles in a way which preserves their
property of being a (non-canonical) subset of the valid gnu-config
triples.  This commit is required in order to exploit that discovery
to add automatic detection of ILP32 platforms (64-bit void*, 32-bit
int, like the Apple Watch and MIPS n32) to Nix.
2023-10-22 17:05:05 -07:00
Yueh-Shun Li
0695d3e8fe lib.overrideDerivation: inter-link the documentation
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-10-21 16:39:12 +08:00