| 23 Jan 2024 |
| lovesegfault changed their profile picture. | 19:29:12 |
| 24 Jan 2024 |
| @nm0i:matrix.org joined the room. | 07:46:37 |
| 27 Jan 2024 |
| @sethrankada52:matrix.org joined the room. | 14:04:20 |
| @lehmanator:gnulinux.club removed their profile picture. | 16:55:37 |
| @lehmanator:gnulinux.club removed their display name Sam Lehman. | 16:59:44 |
| @lehmanator:gnulinux.club left the room. | 17:05:49 |
| 28 Jan 2024 |
| nf changed their profile picture. | 14:04:00 |
lxsameer | hey folkss, when running nix store gc, how does nix know what to delete? does it know what flake.lock files do I have? | 21:13:05 |
@qyriad:matrix.org | nix-store --gc --print-roots | 21:30:14 |
@qyriad:matrix.org | Any store paths that are transitively referenced by any gc roots — which in practice are running processes and any symlinks outside of the store to paths inside the store — won't be deleted | 21:30:56 |
@qyriad:matrix.org | flake.lock doesn't come into the picture directly | 21:31:45 |
mr-qubo | In reply to @lxsameer:matrix.org hey folkss, when running nix store gc, how does nix know what to delete? does it know what flake.lock files do I have? It doesn't know about flake.lock by default. But it's possible to add it as a root manually. Some projects, e.g. direnv, do that for you. | 22:24:36 |
lxsameer | Interesting | 22:41:29 |
lxsameer | I'm not on nixos and i want to gc the store without removing my flake related packages | 22:42:09 |
@qyriad:matrix.org | what do you mean by "flake related packages"? | 22:43:34 |
lxsameer | I use flakes to manage the dependencies in my projects. for example i install clang toolchain and few other things in my flake, when I do nix store gc I don't want nix to remove them | 22:45:06 |
@qyriad:matrix.org | if you have done something like nix build, that creates a result symlink in the flake directory. That symlink will keep those packages from being garbage collected | 22:46:17 |
lxsameer | ah ok, what about packages that I add to my devshell ? | 22:47:14 |
@qyriad:matrix.org | nix develop doesn't create a gc root (except for processes running in that shell) | 22:52:16 |
@qyriad:matrix.org | If you want to create a symlink to those you can run something like nix build --impure --expr 'let flake = builtins.getFlake "/full/path/to/flakedir"; in flake.outputs.devShells.x86_64-linux.default' to create that result symlink | 22:53:46 |
@qyriad:matrix.org | Or you can find the /nix/store path manually and use nix-store --gc --add-root on it | 22:54:04 |
@qyriad:matrix.org | I'm not aware of another way | 22:54:12 |
@qyriad:matrix.org | but also if you run nix store gc you can just re-run nix develop to re-download/build those store paths | 22:54:49 |
Charles | In reply to @lxsameer:matrix.org I use flakes to manage the dependencies in my projects. for example i install clang toolchain and few other things in my flake, when I do nix store gc I don't want nix to remove them if you use direnv and nix-direnv, it will create gc roots for your flakes | 22:57:02 |
lxsameer | Would it be possible to make a root in the flake itself via nix? | 23:00:31 |
| 29 Jan 2024 |
| Sam Lehman joined the room. | 10:58:52 |
| Sam Lehman set a profile picture. | 11:06:03 |
mr-qubo | In reply to @lxsameer:matrix.org Would it be possible to make a root in the flake itself via nix? Just look how direnv does that. | 12:07:30 |
lxsameer | cheers | 12:07:45 |
lxsameer | is there any docs on the structure of the store that I can use while I'm working on this? | 18:14:33 |