Commit graph

14398 commits

Author SHA1 Message Date
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
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
John Ericson
0a715ff9cf
Merge pull request #8154 from tweag/delete-old-on-all-profiles-dir
undefined
2023-05-16 09:51:41 -04: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
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
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
John Ericson
0a9afce3b9 Split mkOutputString in two
This well help us with some unit testing
2023-05-15 09:03:37 -04:00
John Ericson
9550c3862f Remove unneeded argument for mkOutputString 2023-05-15 09:03:37 -04:00
John Ericson
914672dc4f
Merge pull request #8141 from tweag/user-files-doc
Document user files of nix
2023-05-15 07:11:47 -04:00
Théophane Hufschmitt
e97e9e9f00 test the garbage collection with the old profile dir
Regression test for https://github.com/NixOS/nix/issues/8294
2023-05-15 11:58:49 +02:00
Théophane Hufschmitt
64b0cc5bc4 Make nix-collect-garbage -d look into more places
Make it look into the new-style profiles dir, the old-style one, and the
target of `~/.nix-profile` to be sure that we don't miss anything
2023-05-15 11:36:53 +02:00
Valentin Gagarin
b15cba03c3
Merge pull request #8334 from l0b0/patch-1 2023-05-15 09:12:05 +02:00
Victor Engmark
6e1bfb93dc refactor: Join commands to remove files 2023-05-15 11:05:26 +12:00
Victor Engmark
ed016a5bb0 docs: Mention more files referenced by the installer
`/etc/bash.bashrc` is backed up as `/etc/bash.bashrc.backup-before-nix`,
but since other changes might have been introduced in the meantime we can't
just tell the user to revert.
2023-05-15 11:03:27 +12:00
Victor Engmark
e26aad22c6 docs: Remove references to non-existing files
At least on Ubuntu 22.04, these files are not created as part of a multi-
user installation.
2023-05-15 10:26:47 +12:00
Victor Engmark
17a1c1ee4e docs: Sort files by name 2023-05-15 10:16:12 +12:00
Victor Engmark
3cc9b8630b docs: Remove Nix profile content from correct directory
At least on Ubuntu 22.04, the Nix installer creates
`/etc/profile.d/nix.sh`, not `/etc/profile/nix.sh`.
2023-05-15 10:13:46 +12:00
Victor Engmark
ccf512f4b8 docs: Remove redundant uninstall command
`sudo systemctl disable nix-daemon.socket nix-daemon.service` removes these
files already.
2023-05-15 10:06:27 +12:00
Valentin Gagarin
454e273451
Merge pull request #8328 from urbas/max-substitution-jobs 2023-05-14 11:59:40 +02:00
Matej Urbas
c66a7af0c6 max-substitution-jobs release note entry 2023-05-14 09:51:11 +01:00
Valentin Gagarin
29db89fe7c
Merge pull request #8326 from Hoverbear/describe-or-slightly-more 2023-05-13 20:40:40 +02:00
Ana Hobden
17fb346ec6 Describe the or operation on attribute sets slightly more 2023-05-12 11:03:09 -07:00
Alexander Bantyev
992be330ab
Update doc/manual/src/SUMMARY.md.in
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-05-12 16:58:01 +04:00
Théophane Hufschmitt
916da456cb
Merge pull request #8319 from fricklerhandwerk/doc-builtins-prefix
reword introduction to built-in functions
2023-05-12 13:19:32 +02:00
Théophane Hufschmitt
491fabda49
Merge pull request #8314 from fricklerhandwerk/doc-builtins
reword documentation on `builtins`
2023-05-12 13:13:32 +02:00
Eelco Dolstra
643b8d2126
Merge pull request #8299 from urbas/max-substitution-jobs
`max-substitution-jobs` setting
2023-05-12 12:24:27 +02:00
Valentin Gagarin
70eb9c7ddb reword introduction to built-in functions
add anchor to `builtins.derivation` and list some built-in functions that are
exposed in the global scope.

I decided not to list everything, because we probably don't want to
encourage people using them that way.
2023-05-11 20:07:42 +02:00
Valentin Gagarin
69a0e6f86c reword documentation on builtins
- add anchor to `builtins`
- add type information
- reword description of `builtins` to offer more information concisely
2023-05-11 17:46:37 +02:00
Valentin Gagarin
2ef7f14e28 do not indent markdown list 2023-05-11 15:29:03 +02:00
Théophane Hufschmitt
f60b215639
Merge pull request #8310 from obsidiansystems/fix-8141
Fix `nix print-dev-env` & `nix develop` with drv paths
2023-05-10 18:01:29 +02:00
John Ericson
a93110ab19 Fix nix print-dev-env & nix develop with drv paths
Fixes #8309

This regression was because both `CmdDevelop` and `CmdPrintDevEnv` were
switched to be `InstallableValueCommand` subclasses, but actually
neither should have been.

The `nixpkgsFlakeRef` method should indeed not be on the base
installable class, because "flake refs" and "nixpkgs" are not
installable-wide notions, but that doesn't mean these commands should
only accept installable values.
2023-05-10 11:29:45 -04:00