Théophane Hufschmitt
e58c47cc1a
Fix the std::filesystem linking on darwin
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
83365a79bc
Also build the findroots library for darwin
...
Might fail at link time, but not building it will fail anyways, so…
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
d4bbb1dec7
Escape the file paths before sending them
...
Make sure that a file-path containing a `\t` or a `\n` doesn’t mess with
everything
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
8de54ed4e1
Gate the external gc behind an xp feature flag
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
240f1614d8
Add a proper nix option for the external GC
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
d97b9f138c
nix-find-roots: Support systemd socket activation
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
f6a30993f0
Rename the find-roots library
...
Give it a name more in line with the rest
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
072f420260
Remove the old gc methods from LocalStore
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
2c47b08e17
Use the standalone gc lib in the default gc
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
fbec849281
Split the root finding in a separate library
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
80bb58b186
Properly get the temp roots when using the external gc daemon
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
dadc4a42c6
Make the gc socket path configurable
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
1d5d30b12f
Make the root-tracer directly listen on a socket
...
Complicates the code quite a bit (compared to letting systemd handle
that for us), but makes things much easier to test
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
e1df6c220a
Censor the gc roots that aren’t under stateDir
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
8f622ff71b
Don’t fail when the store contains some invalid paths
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
f3b9d3fd88
Add a message if the external tracer isn’t available
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
9a3c3cb748
Make nix-collect-garbage use the trace socket
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
63159dd672
nix-find-roots: Fully disable on darwin
...
Until I can understand why it’s not working
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
4d9ca6d09e
Fallback to the old mechanism if the gc socket isn’t found
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
26c802d18c
Communicate with the gc daemon via a socket
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
aadf585ea3
Fix build on darwin
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
35c7d5d2f1
gc: Only track sensible paths from maps file
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
3839eb15d6
Also check the NixOS specific files
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
61c35a810b
gc: Use the trace helper
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
93739ce006
Dump the whole file when scaning its content
...
Dumping the fstream to a string just dumps a certain number of bits of
it, causing some references to be missed
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
5d47c37cbc
Track the runtime roots
...
Everything that’s potentially accessed by a running program (its own
path, its environment, mmapped files, etc..)
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
2e7f1d24a1
gc: Also track the original roots
...
Will be required by `--print-roots` and friends
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
c788718de1
Specialise for searching under $stateDir/{profiles,gcroots}
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
b4ab02ef13
Add an external executable to trace the gc roots back to the store
2022-04-13 10:24:53 +02:00
Théophane Hufschmitt
a2bcf35e0d
Properly migrate the existing profiles
...
Make sure that the default profile (including all its generations) are
still available after we move it to the user’s home directory
2022-04-13 10:22:07 +02:00
regnat
be28cb9262
Migrate the old profiles to the new location
...
Make sure that we don’t just create the new profiles directory, but that
we also migrate every existing profile to it.
2022-04-13 10:13:43 +02:00
regnat
a3979e67f4
Move the default profiles to the user’s home
...
Rather than using `/nix/var/nix/{profiles,gcroots}/per-user/`, put the user
profiles and gcroots under `$XDG_DATA_DIR/nix/{profiles,gcroots}`.
This means that the daemon no longer needs to manage these paths itself
(they are fully handled client-side). In particular, it doesn’t have to
`chown` them anymore (removing one need for root).
This does change the layout of the gc-roots created by nix-env, and is
likely to break some stuff, so I’m not sure how to properly handle that.
2022-04-13 10:13:41 +02:00
Eelco Dolstra
0a26f9ae4a
Don't hide repeated values while generating manifest.nix
...
Fixes #6243 .
(cherry picked from commit a0259a21a4 )
2022-03-22 13:09:47 +00:00
Eelco Dolstra
fc553fb632
printValue(): <REPEAT> -> «repeated»
...
This ensures that it doesn't get parsed as a valid Nix expression.
(cherry picked from commit 732296ddc0 )
2022-03-22 13:09:47 +00:00
Eelco Dolstra
504e3b2a8f
Style
2022-03-07 20:07:43 +01:00
Eelco Dolstra
fa614fac7f
Merge branch 'GuillaumeDesforges/issue6192' of https://github.com/GuillaumeDesforges/nix
2022-03-07 19:58:06 +01:00
Eelco Dolstra
30ddd37873
Merge branch 'cli-suggestions' of https://github.com/thufschmitt/nix
2022-03-07 19:47:45 +01:00
Guillaume Desforges
436c6e900f
Explicit error in flake init/new when not in store
2022-03-07 17:57:52 +01:00
regnat
dcf4f77fac
Merge or-suggestions.hh into suggestions.hh
...
No real need for keeping a separate header for such a simple class.
This requires changing a bit `OrSuggestions<T>::operator*` to not throw
an `Error` to prevent a cyclic dependency. But since this error is only
thrown on programmer error, we can replace the whole method by a direct
call to `std::get` which will raise its own assertion if needs be.
2022-03-07 17:49:02 +01:00
Robert Hensing
da260f579d
dupStringWithLen -> makeImmutableString
...
Refactor the `size == 0` logic into a new helper function that
replaces dupStringWithLen.
The name had to change, because unlike a `dup`-function, it does
not always allocate a new string.
2022-03-07 16:09:12 +01:00
Robert Hensing
bbf55383e7
Value::mkPath: Avoid potential crash from null string_view
2022-03-07 16:09:12 +01:00
Robert Hensing
1b978596b5
Value::mkString: Avoid crash from null string_view
2022-03-07 16:09:12 +01:00
regnat
313bbc07a8
Implement operator<< for Suggestions
...
That way there’s no need to explicitely convert it to a string when
printing it
2022-03-07 10:09:10 +01:00
regnat
fd45d85b41
Move OrSuggestions to its own header
...
Prevents a recursive inclusion
2022-03-07 10:09:10 +01:00
regnat
98e361ad4c
Also display suggestions for the commands using the eval cache
...
Make `nix build .#nix-armv8l-linux` work for example
2022-03-07 10:09:10 +01:00
regnat
2405bbbb5e
Add some tests for the suggestions
2022-03-07 10:09:10 +01:00
regnat
c0792b1546
Implement a suggestions mechanism
...
Each `Error` class now includes a set of suggestions, and these are printed by
the top-level handler.
2022-03-07 10:09:09 +01:00
Théophane Hufschmitt
a2ace54fe4
Merge pull request #6029 from Ma27/nix-log-ssh-ng
...
ssh-ng: also store build logs to make them accessible by `nix log`
2022-03-07 09:51:40 +01:00
Nicholas Sielicki
314852a10e
Point to new github oauth docs url
...
Previous URL was 404'ing.
2022-03-06 17:01:14 -06:00
John Ericson
6636202356
Factor out a GcStore interface
...
Starts progress on #5729 .
The idea is that we should not have these default methods throwing
"unimplemented". This is a small step in that direction.
I kept `addTempRoot` because it is a no-op, rather than failure. Also,
as a practical matter, it is called all over the place, while doing
other tasks, so the downcasting would be annoying.
Maybe in the future I could move the "real" `addTempRoot` to `GcStore`,
and the existing usecases use a `tryAddTempRoot` wrapper to downcast or
do nothing, but I wasn't sure whether that was a good idea so with a
bias to less churn I didn't do it yet.
2022-03-03 19:01:25 +00:00