A modern, delicious implementation of the Nix package manager, focused on correctness, usability, and growth — and committed to doing right by its community https://lix.systems
Find a file
John Ericson 3d065192c0 Overhaul completions, redo #6693 (#8131)
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-25 15:30:36 +00:00
.github un-thumbs-up ur github templates 2024-03-13 23:10:25 -07:00
clang-tidy clang-tidy check infrastructure 2024-03-18 16:10:29 -07:00
config Run autoupdate 2021-06-01 11:42:38 +02:00
contrib function-trace: always show the trace 2019-09-18 23:23:21 +02:00
doc Improve new CLI UX by supporting short -E flag for --expr 2024-03-24 21:17:51 -06:00
m4 Merge pull request #6258 from obsidiansystems/gcc-bug-ergonomics 2024-03-04 05:24:33 +01:00
maintainers issue importer: list issues that are *not* closed when finding existing issues 2024-03-18 18:14:31 -07:00
meson build: optionally build and install with meson 2024-03-22 08:36:50 -06:00
misc un-ups your start 2024-03-18 18:28:08 -07:00
mk Merge "Backport PR#10204 by 9999years: Replace foo with __NIX_STR in cxx-big-literal" into main 2024-03-14 00:07:21 -06:00
perl Merge pull request #9152 from obsidiansystems/split-out-perl-nix 2024-03-04 04:37:44 +01:00
scripts Restore system-install profile files from the previous installer 2024-03-25 04:17:14 +00:00
src Overhaul completions, redo #6693 (#8131) 2024-03-25 15:30:36 +00:00
tests feat: notation to refer to no attribute search prefix 2024-03-25 15:30:36 +00:00
.clang-format Add clang format configuration 2024-03-18 13:31:39 -07:00
.dir-locals.el .dir-locals.el: Set c-block-comment-prefix 2020-07-10 11:21:06 +02:00
.editorconfig Add .editorconfig 2017-06-05 22:57:28 +01:00
.gitignore Merge pull request #10085 from ShamrockLee/ignore-obsolete-testdir 2024-03-05 23:36:31 -07:00
.version Update version to 2.90.0 2024-03-07 19:57:39 -07:00
boehmgc-coroutine-sp-fallback.diff Merge pull request #8887 from obsidiansystems/bsd-cross-ci 2024-03-04 04:36:04 +01:00
boehmgc-traceable_allocator-public.diff Merge pull request #9430 from hercules-ci/remove-vlas 2024-03-04 07:11:25 +01:00
configure.ac Merge pull request #9844 from NixOS/pkg-config-gmock 2024-03-04 08:47:39 +01:00
CONTRIBUTING.md Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
COPYING * Change this to LGPL to keep the government happy. 2006-04-25 16:41:06 +00:00
default.nix add flake-compat to flake.nix and use sha256 in default.nix 2023-03-06 21:11:24 +01:00
docker.nix fix "add an option to include flake-registry..." 2023-05-16 14:35:31 +02:00
flake.lock flake.nix: upgrade to nixos-23.11 2024-03-08 23:59:01 +00:00
flake.nix build: optionally build and install with meson 2024-03-22 08:36:50 -06:00
local.mk Merge pull request #9106 from Ericson2314/positive-source-filtering 2024-03-04 04:36:42 +01:00
Makefile un-ups your start 2024-03-18 18:28:08 -07:00
Makefile.config.in Merge pull request #9106 from Ericson2314/positive-source-filtering 2024-03-04 04:36:42 +01:00
meson.build build: optionally build and install with meson 2024-03-22 08:36:50 -06:00
meson.options build: optionally build and install with meson 2024-03-22 08:36:50 -06:00
package.nix build: optionally build and install with meson 2024-03-22 08:36:50 -06:00
precompiled-headers.h Config: Use nlohmann/json 2020-08-20 11:02:16 +02:00
README.md Improve hacking.md 2023-02-13 12:00:00 +04:00
shell.nix Remove url literals 2022-01-24 13:28:21 +01:00

Nix

Open Collective supporters Test

Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. Please refer to the Nix manual for more details.

Installation

On Linux and macOS the easiest way to install Nix is to run the following shell command (as a user other than root):

$ curl -L https://nixos.org/nix/install | sh

Information on additional installation methods is available on the Nix download page.

Building And Developing

See our Hacking guide in our manual for instruction on how to to set up a development environment and build Nix from source.

Additional Resources

License

Nix is released under the LGPL v2.1.