Silvan Mosberger
4164b1c47e
lib.fileset: Re-order to match reference overview
2023-11-19 23:52:13 +01:00
Silvan Mosberger
13f0af428e
lib.fileset: Add overview section to reference docs
2023-11-19 23:46:23 +01:00
Silvan Mosberger
5a7118da75
Merge pull request #268520 from tweag/fileset-minor-changes
...
`lib.fileset`: Minor changes
2023-11-19 19:12:29 +01:00
Silvan Mosberger
b514f0433c
lib.fileset: Minor changes
...
- Make fromSource's missing file error message more consistent with others,
and add a test for it
- Indent some function arguments
- Fix an internal type
2023-11-19 16:06:14 +01:00
Silvan Mosberger
228df50ff9
lib.fileset: Move introduction section above the functions
...
Previously the introductory section and the function listings were in
different places. But now nixdoc supports having them together
with https://github.com/nix-community/nixdoc/pull/70 !
2023-11-19 15:00:57 +01:00
Silvan Mosberger
ada680bcfa
lib.fileset.gitTracked: Better error in pure eval
2023-11-16 14:42:26 +01:00
Silvan Mosberger
d33f1a62f5
lib.fileset.gitTrackedWith: Introduce recurseSubmodules parameter
2023-11-16 01:12:18 +01:00
Silvan Mosberger
2dfb1d36cf
lib.fileset.gitTracked/gitTrackedWith: init
...
A configuration parameter for gitTrackedWith will be introduced in the
next commit
2023-11-16 01:12:15 +01:00
Silvan Mosberger
1c3eb9eff1
lib.fileset.fileFilter: Restrict second argument to paths
...
While this change is backwards-incompatible, I think it's okay because:
- The `fileFilter` function is not yet in a stable NixOS release, it was only merged about [a month ago](https://github.com/NixOS/nixpkgs/pull/257356 ).
- All public uses of the function on GitHub only pass a path
- Any `fileFilter pred fileset` can also be expressed as `intersection fileset (fileFilter pred path)` without loss of functionality.
- This is furthermore pointed out in the new error message when a file set is passed
2023-11-15 01:20:36 +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
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
Silvan Mosberger
9ec104bb2d
lib.fileset: Very minor changes
2023-11-13 23:57:52 +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
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
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
2312523ab3
lib.fileset: Add an additional argument in the design docs
2023-11-01 22:38:48 +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
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
Silvan Mosberger
f4e0043049
lib.fileset.fileFilter: init
2023-10-24 01:44:04 +02:00
Silvan Mosberger
7247ec07ba
lib.fileset: Improved error for unsupported coercion values
2023-10-16 15:50:10 +02:00
Silvan Mosberger
006b28f2a8
Merge pull request #257356 from tweag/fileset.intersect
...
`lib.fileset.intersection`: init
2023-10-11 17:33:32 +02:00
Silvan Mosberger
389be8db81
lib.fileset: Minor contributor doc adjustments
...
Co-authored-by: Robert Hensing <robert@roberthensing.nl>
2023-10-11 16:18:00 +02:00
Silvan Mosberger
4ecf025814
lib.fileset.intersection: init
2023-10-11 16:17:48 +02:00
Valentin Gagarin
61fa1255f8
link to documentation on IFD in the Nix manual
2023-10-09 23:57:03 +02:00
Silvan Mosberger
2541635c13
lib.fileset: Refactor for performance and future re-use
2023-10-04 23:21:45 +02:00
Silvan Mosberger
5db719f69c
Merge pull request #256417 from tweag/fileset.trace
...
`lib.fileset.trace`, `lib.fileset.traceVal`: init
2023-10-04 17:39:20 +02:00
Silvan Mosberger
5b4e53a300
lib.fileset: Don't use ulimit for testing tracing
2023-10-04 16:31:14 +02:00
Silvan Mosberger
692b75257e
lib.fileset: Refactor inotify testing to be reusable
2023-10-04 16:31:13 +02:00
Silvan Mosberger
5bbe67bf67
lib.fileset: Mention trace functions in the file set evaluation error
2023-10-04 16:31:13 +02:00
Silvan Mosberger
704452f29c
lib.fileset.traceVal: init
2023-10-04 16:31:11 +02:00
Silvan Mosberger
467e428f00
lib.fileset.trace: init
2023-10-04 16:30:10 +02:00
Silvan Mosberger
ac2c8d321c
lib.fileset: Make expectEqual check more
2023-10-04 16:29:03 +02:00
Silvan Mosberger
efbcf5938f
lib.fileset: Add internal helpers for pretty-printing
2023-10-04 16:28:55 +02:00
Silvan Mosberger
81e8f48ebd
Merge pull request #258855 from tweag/fileset.doc-fix
...
`lib.fileset.unions`: Fix outdated docs
2023-10-04 01:24:04 +02:00
Silvan Mosberger
d5743d9268
lib.fileset.unions: Fix outdated docs
...
Since 4f35f003e6
unions supports empty lists too
2023-10-03 21:56:53 +02:00
Silvan Mosberger
86802e19ce
lib.fileset: _simplifyTree -> _normaliseTreeFilter
2023-10-03 21:27:42 +02:00
Silvan Mosberger
b3c2281219
lib.fileset: Order noEval last
2023-10-03 21:27:40 +02:00
Silvan Mosberger
43e4d8a6a1
lib.fileset: Link to user documentation from contributor docs
2023-10-03 18:50:18 +02:00
Robert Hensing
812887f16f
Merge pull request #257351 from tweag/fileset.empty
...
`lib.fileset`: Representation for empty file sets without a base path
2023-10-03 18:26:09 +02:00
Silvan Mosberger
4f35f003e6
lib.fileset: Internal representation v3, empty value without a base
...
`unions []` now works!
Notably the new empty value without a base is not exposed in the interface.
I don't know of any use case for it.
2023-10-03 17:05:57 +02:00
Silvan Mosberger
3cbbea53a1
lib.fileset: Don't use non-reproducible ulimit for stack overflow testing
2023-09-29 20:30:29 +02:00