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
Eelco Dolstra
e9c04c3351
Be more aggressive in hiding repeated values
...
We now memoize on Bindings / list element vectors rather than Values,
so that e.g. two Values that point to the same Bindings will be
printed only once.
2022-03-03 13:33:34 +01:00
Eelco Dolstra
ecff9d969a
printValue(): Don't show repeated values
...
Fixes #6157 .
2022-03-03 13:18:23 +01:00
Eelco Dolstra
6097790863
Fix segfault in headerCallback()
...
https://hydra.nixos.org/build/168594664
2022-03-03 11:11:16 +01:00
Eelco Dolstra
a7c835e9cb
Use C++11-style initializer
...
Co-authored-by: John Ericson <git@JohnEricson.me >
2022-03-03 10:02:11 +01:00
Eelco Dolstra
b55d79728c
Add EvalState::coerceToStorePath() helper
...
This is useful whenever we want to evaluate something to a store path
(e.g. in get-drvs.cc).
Extracted from the lazy-trees branch (where we can require that a
store path must come from a store source tree accessor).
2022-03-02 23:58:58 +01:00
Eelco Dolstra
161f798aa1
nix profile: Support CA derivations
2022-03-02 20:38:51 +01:00
Eelco Dolstra
54888b92de
Move installables-related operations
2022-03-02 19:19:51 +01:00
Eelco Dolstra
b39ef07414
Style
2022-03-02 11:46:15 +01:00
Eelco Dolstra
010ffc31f8
Remove stray debug line
2022-03-02 11:20:32 +01:00
Eelco Dolstra
03df331c3f
Merge pull request #6189 from obsidiansystems/build-result-header
...
Move `BuildResult` defintion to its own header
2022-03-02 08:47:51 +01:00
Anders Kaseorg
b5cd3e2d5c
filterANSIEscapes: Ignore BEL character
...
GCC is not as good at music as it seems to think it is. Fixes #4546 .
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-03-01 15:35:42 -08:00
John Ericson
e862833ec6
Move BuildResult defintion to its own header
...
Just like we did for `ValidPathInfo` in
d92d4f85a5 .
2022-03-01 19:43:07 +00:00
Eelco Dolstra
0cb5af5000
Merge pull request #6185 from hercules-ci/fetchTree-reuse-local-paths
...
fetchTree: Use isValidPath, add comment
2022-03-01 13:15:42 +01:00