aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/common-eval-args.cc
AgeCommit message (Collapse)Author
2024-10-15treewide: consistently mark overridden settings as suchAlois Wohlschlager
Only overridden settings are sent to the daemon, and we're going to do the same for the build hook to. It needs to be ensured that overridden settings are in fact consistently marked as such, so that they actually get sent. Change-Id: I7cd58d925702f86cf2c35ad121eb191ceb62a355
2024-09-15common-eval-args: raise warning if `--arg` isn't a valid Nix identifierMaximilian Bosch
See https://git.lix.systems/lix-project/lix/issues/496. The core idea is to be able to do e.g. nix-instantiate -A some-nonfree-thing --arg config.allowUnfree true which is currently not possible since `config.allowUnfree` is interpreted as attribute name with a dot in it. In order to change that (probably), Jade suggested to find out if there are any folks out there relying on this behavior. For such a use-case, it may still be possible to accept strings, i.e. `--arg '"config.allowUnfree"'. Change-Id: I986c73619fbd87a95b55e2f0ac03feaed3de2d2d
2024-06-01chore: rebrand Nix to Lix when it makes senseRaito Bezarius
Here's my guide so far: $ rg '((?!(recursive).*) Nix (?!(daemon|store|expression|Rocks!|Packages|language|derivation|archive|account|user|sandbox|flake).*))' -g '!doc/' --pcre2 All items from this query have been tackled. For the documentation side: that's for https://git.lix.systems/lix-project/lix/issues/162. Additionally, all remaining references to github.com/NixOS/nix which were not relevant were also replaced. Fixes: https://git.lix.systems/lix-project/lix/issues/148. Fixes: https://git.lix.systems/lix-project/lix/issues/162. Change-Id: Ib3451fae5cb8ab8cd9ac9e4e4551284ee6794545 Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-05-29util.hh: Delete remaining file and clean up headersTom Hubrecht
Change-Id: Ic1f68e6af658e94ef7922841dd3ad4c69551ef56
2024-05-23cleanup lookupFileArgQyriad
Change-Id: I2acd56e7a542b12138f43c95af78fdd50e944619
2024-03-25Overhaul completions, redo #6693 (#8131)John Ericson
As I complained in https://github.com/NixOS/nix/pull/6784#issuecomment-1421777030 (a comment on the wrong PR, sorry again!), #6693 introduced a second completions mechanism to fix a bug. Having two completion mechanisms isn't so nice. As @thufschmitt also pointed out, it was a bummer to go from `FlakeRef` to `std::string` when collecting flake refs. Now it is `FlakeRefs` again. The underlying issue that sought to work around was that completion of arguments not at the end can still benefit from the information from latter arguments. To fix this better, we rip out that change and simply defer all completion processing until after all the (regular, already-complete) arguments have been passed. In addition, I noticed the original completion logic used some global variables. I do not like global variables, because even if they save lines of code, they also obfuscate the architecture of the code. I got rid of them moved them to a new `RootArgs` class, which now has `parseCmdline` instead of `Args`. The idea is that we have many argument parsers from subcommands and what-not, but only one root args that owns the other per actual parsing invocation. The state that was global is now part of the root args instead. This did, admittedly, add a bunch of new code. And I do feel bad about that. So I went and added a lot of API docs to try to at least make the current state of things clear to the next person. -- This is needed for RFC 134 (tracking issue #7868). It was very hard to modularize `Installable` parsing when there were two completion arguments. I wouldn't go as far as to say it is *easy* now, but at least it is less hard (and the completions test finally passed). Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io> Change-Id: If18cd5be78da4a70635e3fdcac6326dbfeea71a5 (cherry picked from commit 67eb37c1d0de28160cd25376e51d1ec1b1c8305b)
2024-03-17Delete hasPrefix and hasSuffix from the codebaseJade Lovelace
These now have equivalents in the standard lib in C++20. This change was performed with a custom clang-tidy check which I will submit later. Executed like so: ninja -C build && run-clang-tidy -checks='-*,nix-*' -load=build/libnix-clang-tidy.so -p .. -fix ../tests | tee -a clang-tidy-result Change-Id: I62679e315ff9e7ce72a40b91b79c3e9fc01b27e9
2023-07-31Move evaluator settings (type and global) to separate file/headerJohn Ericson
2023-07-09Clean up `SearchPath`John Ericson
- Better types - Own header / C++ file pair - Test factored out methods - Pass parsed thing around more than strings Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-06-13Allow tarball URLs to redirect to a lockable immutable URLEelco Dolstra
Previously, for tarball flakes, we recorded the original URL of the tarball flake, rather than the URL to which it ultimately redirects. Thus, a flake URL like http://example.org/patchelf-latest.tar that redirects to http://example.org/patchelf-<revision>.tar was not really usable. We couldn't record the redirected URL, because sites like GitHub redirect to CDN URLs that we can't rely on to be stable. So now we use the redirected URL only if the server returns the `x-nix-is-immutable` or `x-amz-meta-nix-is-immutable` headers in its response.
2023-04-06Backport SourcePath from the lazy-trees branchEelco Dolstra
This introduces the SourcePath type from lazy-trees as an abstraction for accessing files from inputs that may not be materialized in the real filesystem (e.g. Git repositories). Currently, however, it's just a wrapper around CanonPath, so it shouldn't change any behaviour. (On lazy-trees, SourcePath is a <InputAccessor, CanonPath> tuple.)
2023-03-27Merge pull request #8084 from edolstra/store-docsEelco Dolstra
Auto-generate store documentation
2023-03-23Document store URLsEelco Dolstra
2023-03-20Move enabled experimental feature to libutil structJohn Ericson
This is needed in subsequent commits to allow the settings and CLI args infrastructure itself to read this setting.
2023-01-10doc/manual: Introduce @docroot@ as a stable base for includable snippetsRobert Hensing
This way the links are clearly within the manual (ie not absolute paths), while allowing snippets to reference the documentation root reliably, regardless of at which base url they're included.
2022-12-13documentation: link flake URL term to definitionSolène Rapenne
2022-12-13documentation: fix link to definitionSolène Rapenne
2022-12-12Add docs from the lazy-trees branchEelco Dolstra
2022-12-12Support flake references in the old CLIEelco Dolstra
Fixes #7026.
2022-12-12Move isUri() and resolveUri() out of filetransfer.ccEelco Dolstra
These are purely related to NIX_PATH / -I command line parsing, so put them in libexpr.
2022-12-12-I description: Use -I examplesEelco Dolstra
2022-12-12Manual improvementsEelco Dolstra
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2022-12-07Trivial changes from the lazy-trees branchEelco Dolstra
2022-10-12Move some options into a misc categoryEelco Dolstra
This unclutters the per-command options a bit by moving out some global options.
2022-03-07Add shell completion for --override-flakeNaïm Favier
Requires moving the MixEvalArgs class from libexpr to libcmd because that's where completeFlakeRef is.