Nix Flakes | 901 Members | |
| 184 Servers |
| Sender | Message | Time |
|---|---|---|
| 10 Dec 2023 | ||
In reply to @janik0:matrix.orgAs promised, even so it took some time but here it is: https://discourse.nixos.org/t/announcing-nixos-dns/36702 | 21:47:19 | |
| 11 Dec 2023 | ||
| 12:49:14 | ||
| When using flakes to manage my system, and having `nixos-unstable` and `home-manager` as inputs, I have to call `sudo nixos-rebuild switch --flake some/path`. Now, that command sometimes downloads around 300 MB of data before actually doing the build (around 150 MB for unstable I suppose, and 148 MB for home-manager). Is it possible to avoid having to wait for that every time? I suppose it might do the downloading when I run `sudo nix-collect-garbage -d` and reboot. (Copied from NixOs, this room might be more suitable for this question) | 12:50:37 | |
In reply to @ryoschin:matrix.org you can try with --offline then it will try to run any
that pins any | 13:04:24 | |
In reply to @janik0:matrix.orgBut my problem is in that sudo nix-collect-garbage -d deletes the sources, and sudo nixos-rebuild switch --flake some/path has to download them again (I suppose that is because they count as cache, so it clears them). I need the gc to not clear them, and the rebuild command to download them only if there is an actual update | 15:14:32 | |
In reply to @janik0:matrix.org* But my problem is in that sudo nix-collect-garbage -d deletes the sources, and sudo nixos-rebuild switch --flake some/path has to download them again (I suppose that is because they count as cache, so it clears them). I need the gc to not clear them, and the rebuild command to re-download them only if there is an actual update | 15:14:57 | |
In reply to @ryoschin:matrix.orgif you add those flakes to the local registry then they will not be collected alternatively I guess you can add them to system.extraDependencies | 15:17:08 | |
In reply to @ryoschin:matrix.orgThere was some setting like keepDerivations or something to prevent that but I'm not at my laptop currently. | 15:17:28 | |
In reply to @2xsaiko:tchncs.deI see. Mind sharing the process? | 15:55:51 | |
In reply to @janik0:matrix.orgYup, there is such an option, but I did not fully understand what it does. Does it keep all the packages I install even if they are not needed anymore, or just keep the two things I needed not to be garbage collected? | 15:57:03 | |
| So, as far as I can tell now, all I need to do is make the flake a GC root, right? So, how do I do that... | 16:07:28 | |
In reply to @ryoschin:matrix.orgI don't know but direnv does this, so you can check how they do it. | 17:00:32 | |
| Alright, I think I managed to apply direnv to this | 17:20:26 | |
In reply to @ryoschin:matrix.orgnix.registry.nixpkgs.flake = inputs.nixpkgs (like Janik said) or system.extraDependencies = [inputs.nixpkgs] | 18:04:20 | |
| 12 Dec 2023 | ||
| i've been looking into this again after some time away, and still can't really find anything: is there a way to exclude one directory from my flake? specifically we have a giant folder of reference PDFs checked into our source tree, and copying them every time a flake is built makes our development shell unusable. this is why we're currently running non-flake nix, but I would love to be able to switch | 08:48:26 | |
| side note: these files are not needed from our nix build, they are just for test runs | 08:49:27 | |
In reply to @peacememories:matrix.orgmaybe this helps? https://github.com/hercules-ci/gitignore.nix | 09:08:56 | |
| i don't believe so. for one, the files are not gitignored because they are meant to be versioned. also, I think this would only work when including a separate directory from my flake? right now the flake is at the root of the repository, so the whole repo is copied into the store before I can do anything with it. I think some people are putting their flake into a subdirectory to work around this? Maybe that's workable for me as well. Still hoping the lazy trees MR gets merged at some point^^ | 09:25:35 | |
| okay, a subfolder alone does not do anything since nix still recognizes the repository root as "the flake" and copies the entire tree. at least that's what it looks like | 09:52:53 | |
| What is a nice way to fill hydraJobs with the packages and checks of a flake? | 12:41:59 | |
| Everyone seems to do this differently. I have this for building NixOS configs.
But not sure if this actually works, or if I configured the jobs manually in hydra... | 13:36:15 | |
| You may have a .jobsets job that generates a json config listing all the hydra jobs exposed in your flake? | 13:49:00 | |
| hmm, is there a more elegant solution for adding overlays in a flake than
or is this just how it's done? | 14:33:42 | |
| (sorry, I feel like I'm asking stupid questions, but it feels like flakes+nix together have so many ways of overriding and referencing packages that it's hard to find the "right" way to do something) | 14:35:55 | |
| there are many ways to do overlays - it really depends on what you need to do with them tbh | 15:10:06 | |
if you "just" want to use them in nixos (or nix-darwin), then a module that does {nixpkgs.overlays = [self.inputs.emacs-overlay.overlay];} (where self is the flake, as referenced in the flake's output closure) does the trick; if you need overlays in the pkgs refs that are used inside the flakes, then your thing seems right | 15:11:44 | |
| (and if you use e.g. flake-parts, it's a different thing altogether) | 15:11:54 | |
In reply to @wucke13:matrix.org | 15:18:13 | |
| (as in https://git.sr.ht/~dblsaiko/nix-extras/tree/master/item/flake.nix#L80) | 15:18:36 | |
| but formally packages are system.attr, while hydraJobs is attr.system | 17:25:01 | |