!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

904 Members
184 Servers

Load older messages


SenderMessageTime
27 Jan 2024
@lehmanator:gnulinux.club@lehmanator:gnulinux.club left the room.17:05:49
28 Jan 2024
@ncfavier:matrix.orgnf changed their profile picture.14:04:00
@lxsameer:matrix.orglxsameer 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@qyriad:matrix.org nix-store --gc --print-roots 21:30:14
@qyriad:matrix.org@qyriad:matrix.orgAny 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 deleted21:30:56
@qyriad:matrix.org@qyriad:matrix.orgflake.lock doesn't come into the picture directly21:31:45
@mr-qubo:matrix.orgmr-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:matrix.orglxsameerInteresting22:41:29
@lxsameer:matrix.orglxsameerI'm not on nixos and i want to gc the store without removing my flake related packages22:42:09
@qyriad:matrix.org@qyriad:matrix.orgwhat do you mean by "flake related packages"?22:43:34
@lxsameer:matrix.orglxsameer 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@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:matrix.orglxsameerah ok, what about packages that I add to my devshell ?22:47:14
@qyriad:matrix.org@qyriad:matrix.org nix develop doesn't create a gc root (except for processes running in that shell) 22:52:16
@qyriad:matrix.org@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@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@qyriad:matrix.orgI'm not aware of another way22:54:12
@qyriad:matrix.org@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:computer.surgeryCharles
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:matrix.orglxsameerWould it be possible to make a root in the flake itself via nix?23:00:31
29 Jan 2024
@lehmanator:tchncs.deSam Lehman joined the room.10:58:52
@lehmanator:tchncs.deSam Lehman set a profile picture.11:06:03
@mr-qubo:matrix.orgmr-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:matrix.orglxsameercheers12:07:45
@lxsameer:matrix.orglxsameeris there any docs on the structure of the store that I can use while I'm working on this?18:14:33
30 Jan 2024
@erremilia:matrix.org@erremilia:matrix.org left the room.19:55:30
31 Jan 2024
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their profile picture.03:36:26
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their profile picture.06:22:05
@bryan.bennett:matrix.orgBryan lxsameer: This is exactly what nix-direnv does, for the record. We create the root in the direnv layout dir (which is kind of what that directory is for - creating state that we need for direnv-related things) 15:34:40
@lxsameer:matrix.orglxsameer
In reply to @bryan.bennett:matrix.org
lxsameer: This is exactly what nix-direnv does, for the record. We create the root in the direnv layout dir (which is kind of what that directory is for - creating state that we need for direnv-related things)
what do you mean by "We create the root in the direnv layout dir"?
16:20:03

Show newer messages


Back to Room ListRoom Version: 6