18 Dec 2024 |
guiniol | not encouraging for the prebuilt version | 00:04:44 |
guiniol | In reply to @irenes:matrix.org if you're working in a flake, one trick I find really useful for debugging is that if I have a nix expression that returns the derivation I want to hack on, I export that derivation from outputs.packages.x86_64-linux.whatever and then I can just do nix build .#whatever What do you mean export? (I'm brand new to this) You make it it's own flake or something? | 00:05:30 |
Irenes | oh, welp | 00:06:11 |
Irenes | oh, no, so | 00:06:15 |
Irenes | your flake.nix file is really just a big list of uh........ dependencies, and then.... different kinds of things that it exports | 00:06:36 |
Irenes | some of the things might be machine configurations, others might be modules that can be included in configs, others might be packages that can be build | 00:06:51 |
Irenes | *built | 00:06:53 |
Irenes | there's like a dozen different things | 00:06:58 |
guiniol | sure, I'm following you | 00:07:14 |
Irenes | this only applies if you're using flakes, if you're not it's not worth setting up flakes over | 00:07:17 |
Irenes | so half the flake.nix is this big output block and there's a few different things that can be under it, and one of the things is packages | 00:07:43 |
Irenes | which is just a set of derivations you can build | 00:08:15 |
Irenes | the same way that if you do nix build nixpkgs#hello it builds the "hello" package from upstream nixpkgs | 00:08:29 |
Irenes | if you do nix build .#hello it looks in the current directory (or the closest enclosing one that has a flake.nix file in it, I think) and looks for a "hello" package defined there | 00:08:58 |
guiniol | (I am using flakes. It seemed a good way to modularise my build, but I may be compltely wrong) | 00:09:07 |
Irenes | (I think it is, yeah. the concept of flakes needs some tweaking and I'm excited for the lix project to eventually get to where we're in a good position to experiment with it, but the basic idea is a reasonable one) | 00:09:39 |
guiniol | In reply to @irenes:matrix.org if you do nix build .#hello it looks in the current directory (or the closest enclosing one that has a flake.nix file in it, I think) and looks for a "hello" package defined there Yes. That's what I do to have one config per host in a single flake | 00:09:42 |
Irenes | (that is my personal view and not the view of the project) | 00:09:51 |
guiniol | (for now, I'm just trying to be along for the ride :D ) | 00:10:16 |
Irenes | right, yes. packages and hosts are in a slightly different namespace, nix build .#foo checks outputs.packages.${system}.foo while nixos-rebuild --flake .#foo checks outputs.nixosConfigurations.foo | 00:10:47 |
Irenes | it's just a shorthand, you can also write out the full attribute path after the # | 00:11:02 |
Irenes | (thanks for being on this ride with us! it's so great how much energy the community has) | 00:11:29 |
guiniol | ack. Makes sense since nixos-rebuild is rebuilding the whole system | 00:11:30 |
Irenes | exactly | 00:11:36 |
Irenes | I do wish the docs said this more prominently. I should send a patch :) | 00:11:50 |
Irenes | so even if you are mostly using a repo to define your machines, you can still have it define some packages too | 00:12:43 |
Irenes | and rapid iteration on stuff you use in your infrastructure is a reason you might want to | 00:12:55 |
guiniol | yes, I tried defining one for caddy with modules | 00:13:12 |
Irenes | the only reason I'm aware of you might not want to is that if the flake.nix gets really long and unwieldy it can be hard to read | 00:13:18 |
Irenes | I see I see | 00:13:24 |