| 19 Jan 2024 |
tomberek | In reply to @janik0:matrix.org
do flake.locks have a specification? I looked through both the rfc repo and the nix repo and couldn't find anything except for soure code. I would assume that there should be some formal-ish document describing the format esp. since there is version field in every flake.lock.
context of this question is that yesterday I read through the robotonix docs and stumbled upon the over-the-air updater which is just a number that increases every version, so usually `date "+%s". this reminded me of the problem I had with the soa record serial field when I built nixos-dns which uses the exact same format to detect updates/changes.
locking at a random flake.lock I noticed that every entry, except for root, has a locked.lastModified field that is just a unix epoch which is the data one could use for soa serials or ota versions and probably other things. And seeing how flake.lock files are just json you could even parse them with builtins.fromJSON. But root which seems like it is the flake it self doesn't have this field.
Closest thing in written form might be the closed: https://github.com/NixOS/rfcs/pull/49/files#diff-7e8d05fadc397ee6d143d6b47af2967d5f467b59820590c69dfc69da0173684dR266 . Also note that we are considering changing the format: https://github.com/NixOS/nix/issues/7730 | 15:01:18 |
| 22 Jan 2024 |
| @ThorHop:matrix.org changed their display name from hopland to IdeallyYes. | 15:05:35 |
| ahoneybun joined the room. | 19:28:54 |
| 23 Jan 2024 |
| @2xsaiko:tchncs.de changed their display name from 2xsaiko to Marco. | 17:54:54 |
| @2xsaiko:tchncs.de changed their display name from Marco to 2xsaiko. | 18:17:33 |
| lovesegfault changed their display name from lovesegfault (Old) to lovesegfault. | 19:28:47 |
| lovesegfault changed their profile picture. | 19:28:58 |
| 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 |
| ncfavier 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 |