Commit Graph

16319 Commits

Author SHA1 Message Date
Théophane Hufschmitt
bb9b33ad6f Reword the experimental feature description.
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2024-02-27 07:00:50 +01:00
Théophane Hufschmitt
7d3328e4cc find-roots: Fix regex to match store paths
Has been made a bit more lenient upstream, so match that
2024-02-27 06:58:42 +01:00
Théophane Hufschmitt
79a2997b9e find-roots: Remove the using std directives
We got rid of them in the rest of the code, so let's do the same here.
2024-02-27 06:53:55 +01:00
Théophane Hufschmitt
86ae77ba22 Don't run the tracing daemon from the Nix store
That would defeat the whole purpose of the thing as it would provide a
nice escalation path from a Nix vulnerability to root access
2024-02-27 06:49:51 +01:00
Théophane Hufschmitt
e68ee65329 Document the installation process with a non-root daemon
Not supported by the installer because there are many moving parts, but
a rough installation guide can help be used for people to get a custom
installation for their needs
2024-02-27 06:37:11 +01:00
Théophane Hufschmitt
1dbba94244 Make sure that pdiGcDaemon is the right pid
Move its definition before a loop that might change `$!`
2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
e859565a20 tests: Pipe the nix-find-roots output to /dev/null
Otherwise the tests get stuck when using the daemon (I didn't understand
why though, so this is a dirty patch more than a proper fix, but at
least it works now)
2024-02-23 10:00:10 +01:00
John Ericson
7f643277e9 pname + version 2024-02-23 10:00:10 +01:00
John Ericson
9e79d2d1b9 Restore some things lost in the rebase 2024-02-23 10:00:10 +01:00
John Ericson
fb7251915b Make rootless daemon NixOS test setup more declarative
I misunderstand what was going on and https://github.com/NixOS/nixpkgs/issues/263248 is a non-issue. That means we can improve the code right away.

Thank you @eclairevoyant for tipping me off that I was mistaken!
2024-02-23 10:00:10 +01:00
John Ericson
24318d8055 Create a NixOS integration test for the rootless daemon
The test plan is taken from
https://github.com/thufschmitt/rootless-nix-daemon-test. That
intentionally used non-NixOS to get around the ambient Nix daemon, but
with newer NixOS we can in fact disable the ambient Nix daemon an run
our own!

A few things which are needed to make this nicer in the future

- https://github.com/NixOS/nixpkgs/issues/3702

  A now-fixed issue, but won't be available until 23.05

- https://github.com/NixOS/nixpkgs/issues/263248
  https://github.com/NixOS/nixpkgs/issues/263250

  Newly opened issues inspired by the process of writing this test.
2024-02-23 10:00:10 +01:00
John Ericson
c53498b0bf nix-find-roots: Don't explicitly link c++fs on Darwin
It is no longer needed. See f4a8426098
which did the same thing in the rest of Nix.
2024-02-23 10:00:10 +01:00
John Ericson
d170ab4d8c tests: Fix config file name 2024-02-23 10:00:10 +01:00
John Ericson
07e6ee93f3 Mark non-header functions static, API docs in header 2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
8dc4ff661c nix-find-roots: Cleanup
Based on an offline review by @mopleen (thanks!)
2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
a97c309198 nix-find-roots: Don't assume that argv[0] exists 2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
bc445dc2b6 Remove the NIX_GC_SOCKET_PATH environment variable
Not really needed since it's configurable from the config (and people
can always use `$NIX_CONFIG` if they really need to configure it from
the CLI)
2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
21efcb7b61 Split the gc-external-daemon test
Improve parallelism a bit
2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
d68268706e Allow the gc roots daemon to use a long socket path
`chdir` to the directory of the socket and only use a relative path to
it to bypass the socket path length limit (like it's done in
`nix::bind`, except that there's no need to fork here since we can
afford changing the directory of the process)
2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
9b32b05956 Use the standalone gc lib in the default gc 2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
6d2631f514 Add some tests for the external gc daemon 2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
db23f5cf2d gc: Use the trace helper 2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
9bbf398d71 Add an external executable to trace the gc roots back to the store 2024-02-23 10:00:10 +01:00
Théophane Hufschmitt
6a5210f48e
Merge pull request #9815 from NixOS/nix-hash-path
`nix hash path`, text hashing for `nix store add`, and preparatory refactors
2024-02-22 17:15:34 +01:00
Eelco Dolstra
f183eef4a0
Merge pull request #10060 from bobvanderlinden/pr-simple-profile-remove-suggestion
profile: suggest removal using profile entry name
2024-02-22 11:02:12 +01:00
Bob van der Linden
4ae5091716
nix profile: suggest removal using entry name
When a file conflict arises during a package install a suggestion is
made to remove the old entry. This was previously done using the
installable URLs of the old entry. These URLs are quite verbose and
often do not equal the URL of the existing entry.

This change uses the recently introduced profile entry name for the
suggestion, resulting in a simpler output.

The improvement is easily seen in the change to the functional test.
2024-02-21 21:58:36 +01:00
John Ericson
2080d89b87
Merge pull request #10038 from edolstra/tarball-git-cache
Use the Git cache for tarball flakes
2024-02-21 15:47:02 -05:00
Eelco Dolstra
e391fc2101 Add comments 2024-02-21 21:15:28 +01:00
Théophane Hufschmitt
774e7ca584
Merge pull request #9914 from 9999years/debugger-on-trace
Enter debugger on `builtins.trace` with an option
2024-02-21 18:32:56 +01:00
Théophane Hufschmitt
36fa8b1bcc
Merge pull request #9943 from 9999years/release-notes
Add release notes
2024-02-21 18:17:50 +01:00
John Ericson
efd36b49e8 nix hash path, and preperatory refactors
- `nix store add` supports text hashing

  With functional test ensuring it matches `builtins.toFile`.

- Factored-out flags for both commands

- Move all common reusable flags to `libcmd`

  - They are not part of the *definition* of the CLI infra, just a usag
    of it.

  - The `libstore` flag couldn't go in `args.hh` in libutil anyways,
    would be awkward for it to live alone

- Shuffle around `Cmd*` hierarchy so flags for deprecated commands don't
  end up on the new ones
2024-02-21 12:11:25 -05:00
Rebecca Turner
b111fba8cd
Add documentation, rename to debugger-on-trace 2024-02-21 09:07:39 -08:00
Eelco Dolstra
3f5d7afe46
Merge pull request #10024 from edolstra/remove-locked-flag
Input: Replace 'locked' bool by isLocked() method
2024-02-21 16:19:15 +01:00
Eelco Dolstra
9ae665b9e1
Merge pull request #10054 from syvb/channel-unpack-count
Say how many channels were unpacked in nix-channel
2024-02-21 12:23:57 +01:00
Eelco Dolstra
09d76e512a GitArchiveInputScheme: Require a NAR hash 2024-02-21 12:08:18 +01:00
Eelco Dolstra
ff4fa4dbd3
Merge pull request #10055 from GrahamDennis/gdennis/faster-flake-lock-parsing
Faster flake.lock parsing
2024-02-21 11:57:44 +01:00
Graham Dennis
7fd0de38c6 Faster flake.lock parsing
This PR reduces the creation of short-lived basic_json objects while
parsing flake.lock files. For large flake.lock files (~1.5MB) I was
observing ~60s being spent for trivial nix build operations while
after this change it is now taking ~1.6s.
2024-02-21 18:40:34 +11:00
syvb
60eeacc24a Say how many channels were unpacked 2024-02-20 19:17:18 -05:00
John Ericson
a1b1070dbe
Merge pull request #9916 from 9999years/quit-whole-program-from-debugger
`:quit` in the debugger should quit the whole program
2024-02-20 18:12:05 -05:00
Rebecca Turner
8e71883e3f
Rename ProcessLineResult variants 2024-02-20 14:52:16 -08:00
Rebecca Turner
2a8fe9a938
:quit in the debugger should quit the whole program 2024-02-20 10:01:13 -08:00
Eelco Dolstra
071dd2b3a4 Input: Replace 'locked' bool by isLocked() method
It's better to just check whether the input has all the attributes
needed to consider itself locked (e.g. whether a Git input has an
'rev' attribute).

Also, the 'locked' field was actually incorrect for Git inputs: it
would be set to true even for dirty worktrees. As a result, we got
away with using fetchTree() internally even though fetchTree()
requires a locked input in pure mode. In particular, this allowed
'--override-input' to work by accident.

The fix is to pass a set of "overrides" to call-flake.nix for all the
unlocked inputs (i.e. the top-level flake and any --override-inputs).
2024-02-20 16:59:15 +01:00
John Ericson
78e7c98b02
Merge pull request #10049 from edolstra/dont-send-experimental-features
Don't send settings that depend on disabled experimental features to the daemon
2024-02-20 09:53:08 -05:00
Eelco Dolstra
0acd783190 Don't send settings that depend on disabled experimental features to the daemon
This fixes warnings like

   warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
   warning: Ignoring setting 'impure-env' because experimental feature 'configurable-impure-env' is not enabled

when using the daemon and the user didn't actually set those settings.

Note: this also hides those settings from `nix config show`, but that
seems a good thing.
2024-02-20 15:28:42 +01:00
Théophane Hufschmitt
d2c6a93bd5
Merge pull request #10044 from edolstra/empty-git-repos
Handle empty Git repositories / workdirs
2024-02-20 14:01:23 +01:00
Eelco Dolstra
cabee98152 Tarball fetcher: Use the content-addressed Git cache
Backported from the lazy-trees branch.
2024-02-20 12:57:36 +01:00
Eelco Dolstra
930b9c8269 PosixSourceAccessor: Support roots that are not directories
We have to support this for `fetchTree { type = "file" }` (and
probably other types of trees that can have a non-directory at the
root, like NARs).
2024-02-20 12:51:15 +01:00
Eelco Dolstra
b00f412f81 Remove bad.tar.xz check, since libarchive doesn't care 2024-02-20 12:51:15 +01:00
Eelco Dolstra
db012d1e63 tests/functional/tarball.sh: Fix invalid file:// URLs 2024-02-20 12:51:15 +01:00
Théophane Hufschmitt
6f4bb1b584
Merge pull request #10043 from edolstra/fix-readonly-fetchToStore
fetchToStore(): Don't always respect settings.readOnlyMode
2024-02-20 12:07:48 +01:00