summaryrefslogtreecommitdiff
path: root/lib/fileset (follow)
Commit message (Expand)AuthorAgeFilesLines
* Format: lib/fileset/internal.nixJohannes Kirschbauer2025-02-121-2/+0
* Docs: migrate format of comments to doc-commentsJohannes Kirschbauer2025-02-121-4/+34
* treewide: format all inactive Nix files•••After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \ --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7 result/bin/apply-formatting $NIXPKGS_PATH Silvan Mosberger2024-12-103-245/+222
* treewide: fix doc typos•••Done with `fd \\\.md$ . --type f -x typos --write-changes` Peder Bergebakken Sundt2024-07-261-1/+1
* doc: migrate filesets to doc-comment format (#303811)•••* doc: migrate filesets to doc-comment format * fix definition list indentationJohannes Kirschbauer2024-05-201-270/+461
* lib.fileset: fix typo: compatibity to compatibilityPhilip Taron2024-04-021-1/+1
* lib.fileset: Fix tests on Darwin, more POSIX•••This was found when trying to run the fileset tests on Darwin (https://github.com/NixOS/nix/pull/9546#issuecomment-1967409445), which mysteriously fail on Darwin: test case at lib/fileset/tests.sh:342 failed: toSource { root = "/nix/store/foobar"; fileset = ./.; } should have errored with this regex pattern: lib.fileset.toSource: `root` \(/nix/store/foobar\) is a string-like value, but it should be a path instead. \s*Paths in strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead. but this was the actual error: error: lib.fileset.toSource: `root` (/nix/store/foobar) is a string-like value, but it should be a path instead. Paths in strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead. After dissecting this, I find out that apparently \s works on Linux, but not on Darwin for some reason! From the bash source code, it looks like <regex.h> with `REG_EXTENDED` is used for all platforms the same, so there's nothing odd there. It's almost impossible to know where <regex.h> comes from, but it looks to be a POSIX thing. So after digging through the almost impossible to find POSIX specifications (https://pubs.opengroup.org/onlinepubs/007908799/xbd/re.html#tag_007_003_005), I can indeed confirm that there's no mention of \s or the like! _However_, there is a mention of `[[:blank:]]`, so we'll use that instead. Silvan Mosberger2024-02-271-48/+52
* lib.fileset.toList: initSilvan Mosberger2024-02-263-2/+82
* lib.fileset.gitTracked: Allow clones of shallow repositories•••The only reason shallow clones are not the default in `builtins.fetchGit` is that `revCount` can't be provided when cloning a shallow repository. However, `revCount` isn't used or exposed by `lib.fileset`. Hence, allowing cloning shallow repositories makes `gitTracked` more general without any drawbacks. Co-authored-by: Silvan Mosberger <github@infinisil.com> ibbem2024-02-012-1/+31
* Remove --simulate-pure-evalSilvan Mosberger2023-12-191-36/+18
* lib.fileset.gitTracked: Support out-of-tree buildsSilvan Mosberger2023-12-193-6/+86
* lib.fileset.fetchGit: RefactoringSilvan Mosberger2023-12-191-18/+24
* lib.fileset.gitTracked: Improve error when passing filesSilvan Mosberger2023-12-112-0/+8
* lib.fileset: Refactor gitTracked and gitTrackedWith•••Introduce an internal function for them to share more behavior. This makes future changes easier. Silvan Mosberger2023-12-112-41/+48
* Merge pull request #266362 from tweag/fileset.fileFilter-ext•••`lib.fileset.fileFilter`: Predicate attribute for file extensionSilvan Mosberger2023-11-243-3/+46
|\
| * lib.fileset.fileFilter: Predicate attribute for file extensionSilvan Mosberger2023-11-233-3/+46
* | lib.fileset: Document decision for strict existence checks•••Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Silvan Mosberger2023-11-221-0/+13
* | lib.fileset.maybeMissing: initSilvan Mosberger2023-11-204-7/+69
|/
* lib.fileset: Re-order to match reference overviewSilvan Mosberger2023-11-191-200/+200
* lib.fileset: Add overview section to reference docsSilvan Mosberger2023-11-191-2/+44
* Merge pull request #268520 from tweag/fileset-minor-changes•••`lib.fileset`: Minor changesSilvan Mosberger2023-11-193-6/+11
|\
| * 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 Silvan Mosberger2023-11-193-6/+11
* | 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! Silvan Mosberger2023-11-191-0/+49
|/
* lib.fileset.gitTracked: Better error in pure evalSilvan Mosberger2023-11-162-18/+49
* lib.fileset.gitTrackedWith: Introduce recurseSubmodules parameterSilvan Mosberger2023-11-163-6/+53
* lib.fileset.gitTracked/gitTrackedWith: init•••A configuration parameter for gitTrackedWith will be introduced in the next commit Silvan Mosberger2023-11-163-1/+253
* 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 Silvan Mosberger2023-11-154-31/+52
* Merge pull request #267381 from tweag/fileset.fileFilter-path•••`fileset.fileFilter`: Don't run predicate unnecessarilySilvan Mosberger2023-11-153-16/+54
|\
| * 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 Silvan Mosberger2023-11-142-16/+43
| * lib.fileset.fileFilter: Minor cleanups and more testsSilvan Mosberger2023-11-143-2/+13
* | lib.fileset: Very minor changesSilvan Mosberger2023-11-132-4/+1
* | Merge pull request #261732 from tweag/fileset.fromSource•••`lib.fileset.fromSource`: initRobert Hensing2023-11-104-29/+398
|\ \ | |/ |/|
| * lib.fileset.toSource: Mention fromSource in errorsSilvan Mosberger2023-11-084-3/+19
| * lib.fileset.fromSource: initSilvan Mosberger2023-11-083-0/+337
| * lib.fileset: Split out internal test helperSilvan Mosberger2023-11-081-26/+42
* | lib.fileset: Remove unused bindings•••Thanks nixd! Silvan Mosberger2023-11-091-3/+0
* | 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 Silvan Mosberger2023-11-083-45/+47
* | 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 Silvan Mosberger2023-11-081-9/+7
* | lib.fileset: Add an additional argument in the design docsSilvan Mosberger2023-11-011-0/+3
* | Merge pull request #259065 from tweag/fileset.difference•••`lib.fileset.difference`: initSilvan Mosberger2023-11-013-0/+231
|\ \
| * | lib.fileset.difference: initSilvan Mosberger2023-10-303-0/+231
* | | lib.fileset.toSource: Optimise unknown file type error•••Compared to the parent commit, this removes any detectable performance cost :) Silvan Mosberger2023-10-301-27/+28
* | | 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 Silvan Mosberger2023-10-302-20/+33
* | | 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) Silvan Mosberger2023-10-261-0/+5
* | | lib.fileset: Fix shellcheck warnings in testsSilvan Mosberger2023-10-261-4/+4
|/ /
* / lib.fileset.fileFilter: initSilvan Mosberger2023-10-243-0/+144
|/
* lib.fileset: Improved error for unsupported coercion valuesSilvan Mosberger2023-10-162-4/+4
* Merge pull request #257356 from tweag/fileset.intersect•••`lib.fileset.intersection`: initSilvan Mosberger2023-10-114-8/+278
|\
| * lib.fileset: Minor contributor doc adjustments•••Co-authored-by: Robert Hensing <robert@roberthensing.nl> Silvan Mosberger2023-10-111-2/+4
| * lib.fileset.intersection: initSilvan Mosberger2023-10-114-1/+257