1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00
Commit graph

14844 commits

Author SHA1 Message Date
Théophane Hufschmitt dfc393ffd3
Merge pull request #8273 from wamserma/fix-6dbce3
fix "add an option to include flake-registry..."
2023-05-17 10:05:14 +02:00
Ben Radford 5966b76c97
Document the new read-only local store setting. 2023-05-17 09:04:52 +01:00
Ben Radford b1a7b26eef
Rename ReadOnly to Immutable and clarify its purpose. 2023-05-17 09:04:48 +01:00
Ben Radford aa376f4ab1
Need to open database using immutable parameter.
This requires switching on SQLITE_OPEN_URI because there is no open flag to
make the database immutable. Without immutable, sqlite will still attempt to
create journal and wal files, even when the database is opened read-only.

https://www.sqlite.org/c3ref/open.html

The immutable parameter is a boolean query parameter that indicates that the
database file is stored on read-only media. When immutable is set, SQLite
assumes that the database file cannot be changed, even by a process with higher
privilege, and so the database is opened read-only and all locking and change
detection is disabled.
2023-05-17 08:55:04 +01:00
Ben Radford 78fdd6f24e
Open sqlite database according to new modes. 2023-05-17 08:55:04 +01:00
Ben Radford afed9ccfad
Add enum for intended sqlite database open modes. 2023-05-17 08:55:03 +01:00
Ben Radford 7f443e0428
Do not check for write access to database when read-only. 2023-05-17 08:55:03 +01:00
Ben Radford c22936ca6a
Do not attempt to migrate to CA schema when read-only. 2023-05-17 08:55:03 +01:00
Ben Radford 50bbdc65c8
Do not attempt to acquire big-lock when read-only. 2023-05-17 08:55:03 +01:00
Ben Radford 79583c2d38
Do not attempt to chmod per-user dir when read-only. 2023-05-17 08:55:03 +01:00
Ben Radford de359da09a
Add read-only setting to LocalStoreConfig. 2023-05-17 08:55:03 +01:00
Alexander Bantyev 992e2ed0cf
Add a test for ControlMaster 2023-05-17 11:34:45 +04:00
Alexander Schmolck afd9bd787d Also use long options in src/nix/*.md 2023-05-17 08:10:30 +01:00
Alexander Schmolck 8d4b6766e2 Convert short nix options to long ones
e.g. nix-env -e subversion => nix-env --uninstall subversion

The aim is to make the documentation less cryptic for newcomers and the
long options are more self-documenting.

The change was made with the following script:

<https://github.com/aschmolck/convert-short-nix-opts-to-long-ones>

and sanity checked visually.
2023-05-17 08:10:30 +01:00
Konstantin Vukolov 25434df0d9 Ask for git credentials in fetcher 2023-05-17 02:00:32 +03:00
John Ericson 5fd161189d
Merge pull request #8346 from tweag/fix-nix-profile-install-conflict-segfault
Fix the segfault on `nix profile install` with conflict
2023-05-16 15:49:43 -04:00
Ben Radford 4d69bd034a
More detailed explanation of check-mount setting. 2023-05-16 17:27:49 +01:00
Alexander Bantyev 61cdb0b057
Fix ControlMaster behaviour 2023-05-16 18:50:09 +04:00
John Ericson 0a715ff9cf
Merge pull request #8154 from tweag/delete-old-on-all-profiles-dir
undefined
2023-05-16 09:51:41 -04:00
Markus S. Wamser 908bc9a957 fix "add an option to include flake-registry..."
commit 6dbce3215f was missing a pair of
parentheses
2023-05-16 14:35:31 +02:00
Théophane Hufschmitt e997512523 Fix the printing of the installables on nix profile install conflict
- If the element comes from a flake, print the full flakeref (with the
  fragment part) and not just the reference to the flake itself
- If the element doesn't come from a flake, print its store path(s)

This is a bit too verbose, but has the advantages of being correct (and
not crashing), so it's strictly better than the previous situation

Fix https://github.com/NixOS/nix/issues/8284
2023-05-16 11:41:58 +02:00
Théophane Hufschmitt 3d144e778e Rename ProfileElement.describe() to .identifier
This method isn't used to describe what the element is, but to return a
unique identifier for it whithin the current profile
2023-05-16 11:41:58 +02:00
Valentin Gagarin 8976769a1c
Reword info on XDG base dirs (#8338)
This gives some more context and should clarify why it works that way.
Also link it from the section on `NIX_USER_CONF_FILES`.

Co-authored-by: John Ericson <git@JohnEricson.me>
2023-05-15 23:30:20 -04:00
John Ericson 0ec7f2fb3f Create local.mk for local-overlay-store tests 2023-05-15 23:11:29 -04:00
John Ericson 5d18120ba8 Split tests some more
Good for parallelism and easier reading.
2023-05-15 23:11:17 -04:00
John Ericson 97deb00cbc Create notion of "test group", use for local overlay store 2023-05-15 18:13:11 -04:00
John Ericson 1dcb782651 Merge branch 'best-effort-supplementary-groups' into overlayfs-store 2023-05-15 17:49:52 -04:00
John Ericson 754ced4a3f Avoid out links in supplementary groups test
This gets in the way of the tests running in parallel.
2023-05-15 17:49:28 -04:00
John Ericson 3496a5ee86 Merge branch 'best-effort-supplementary-groups' into overlayfs-store 2023-05-15 17:46:15 -04:00
John Ericson d8ef0c9495 Add some tests for drop-supplementary-groups 2023-05-15 17:41:51 -04:00
John Ericson 746c6aae3f Merge remote-tracking branch 'upstream/master' into best-effort-supplementary-groups 2023-05-15 16:50:11 -04:00
John Ericson b1fba1c2a1 Fix PS4 for heredocs 2023-05-15 16:44:36 -04:00
John Ericson 72bb9604f3 Merge remote-tracking branch 'upstream/master' into overlayfs-store 2023-05-15 16:34:19 -04:00
cidkidnix 0979a374c5 Begin to split up overlay-local-store tests
The bad-uris tests are now in their own file.
"Outer" is a bad name, but it will be split up next.
2023-05-15 15:31:57 -05:00
cidkidnix b7e5aaf90d Add test for checking that we reject bad local overlay store uris 2023-05-15 13:41:38 -05:00
John Ericson 2524a21186
Update src/libstore/build/local-derivation-goal.cc
Co-authored-by: Guillaume Girol <symphorien@users.noreply.github.com>
2023-05-15 12:38:39 -04:00
Ben Radford 0df37edb1c Make upper-layer a PathSetting instead of a Setting<string>. 2023-05-15 17:34:31 +01:00
Ben Radford b0989cb10b Support percent encoded URIs for lower store. 2023-05-15 17:34:31 +01:00
Ben Radford b5591ece4c Check that overlay store directory is mounted correctly.
Nix does not manage the overlayfs mount point itself, but the correct
functioning of the overlay store does depend on this mount point being set up
correctly. Rather than just assume this is the case, check that the lowerdir
and upperdir options are what we expect them to be. This check is on by
default, but can be disabled if needed.
2023-05-15 17:34:31 +01:00
John Ericson f8a6a9e473
Merge pull request #8341 from obsidiansystems/dedup-gen-hh
Dedup some markdown -> C++ big literal stuff in build system
2023-05-15 11:44:35 -04:00
Robert Hensing 41591b33a9
Merge pull request #8340 from NixOS/delete-commited-build-artifacts
Delete commited build artifacts
2023-05-15 17:30:20 +02:00
Robert Hensing f175b68646
Merge pull request #8339 from obsidiansystems/fix-rapid-check-instances
Fix some bounds in rapid check instances
2023-05-15 17:23:50 +02:00
John Ericson 98afd6ff76 Delete commited build artifacts
They were improperly added in 8a93b5a551.

They were not `.gitignore`d because they were stale in that commit --
build artifacts no longer used that name by then and so `.gitignore` was
updated accordingly.
2023-05-15 10:50:33 -04:00
John Ericson bbd7d5de09 Fix some bounds in rapid check instances
`inRange` is exclusive not inclusive:
https://github.com/emil-e/rapidcheck/blob/master/doc/generators.md#usage

Furthermore, use `std::variant_size_v` so we use the right number
automatically.

Finally, make the `switch` assert the discriminant is in bounds as
expected.
2023-05-15 10:41:44 -04:00
John Ericson f7c896cfd8 Dedup some markdown -> C++ big literal stuff in build system
This pattern rule was unwisely hidden in `src/libstore/local.mk`. Now it
is properly in `mk/` and we reuse it for the profile docs too.
2023-05-15 10:38:11 -04:00
Robert Hensing 0c49c1af28
Merge pull request #7601 from obsidiansystems/string-installables
Make more string values work as installables
2023-05-15 15:42:57 +02:00
Valentin Gagarin 275468a1f0 list files used by nix-channel 2023-05-15 15:26:14 +02:00
John Ericson d2162e7acd Make more string values work as installables
As discussed in #7417, it would be good to make more string values work
as installables. That is to say, if an installable refers to a value,
and the value is a string, it used to not work at all, since #7484, it
works somewhat, and this PR make it work some more.

The new cases that are added for `BuiltPath` contexts:

- Fixed input- or content-addressed derivation:

  ```
  nix-repl> hello.out.outPath
  "/nix/store/jppfl2bp1zhx8sgs2mgifmsx6dv16mv2-hello-2.12"

  nix-repl> :p builtins.getContext hello.out.outPath
  { "/nix/store/c7jrxqjhdda93lhbkanqfs07x2bzazbm-hello-2.12.drv" = { outputs = [ "out" ]; }; }

  The string matches the specified single output of that derivation, so
  it should also be valid.

- Floating content-addressed derivation:

  ```
  nix-repl> (hello.overrideAttrs (_: { __contentAddressed = true; })).out.outPath
  "/1a08j26xqc0zm8agps8anxpjji410yvsx4pcgyn4bfan1ddkx2g0"

  nix-repl> :p builtins.getContext (hello.overrideAttrs (_: { __contentAddressed = true; })).out.outPath
  { "/nix/store/qc645pyf9wl37c6qvqzaqkwsm1gp48al-hello-2.12.drv" = { outputs = [ "out" ]; }; }
  ```

  The string is not a path but a placeholder, however it also matches
  the context, and because it is a CA derivation we have no better
  option. This should also be valid.

We may also want to think about richer attrset based values (also
discussed in that issue and #6507), but this change "completes" our
string-based building blocks, from which the others can be desugared
into or at least described/document/taught in terms of.

Progress towards #7417

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-05-15 09:03:38 -04:00
John Ericson 5a23b80b0a Create EvalState::coerceToDerivedPath
This gives us some round trips to test.

`EvalState::coerceToDerivedPathUnchecked` is a factored out helper just
for unit testing.
2023-05-15 09:03:37 -04:00
John Ericson 8e1a990268 Expose mkOutputString as method of EvalState 2023-05-15 09:03:37 -04:00