Nix Flakes | 889 Members | |
| 179 Servers |
| Sender | Message | Time |
|---|---|---|
| 7 Nov 2023 | ||
| * do you actually want to refer to your lib or die you mean to import it first? if import, then just import it in a
| 22:03:38 | |
| * do you actually want to refer to your lib or die you mean to import it first? if import, then just import it in a
| 22:03:52 | |
In reply to @mib:kanp.aiOr you use self.lib in the module | 22:03:57 | |
In reply to @crtified:crtified.medo you have to pass self down then or is that "automatic"? | 22:04:35 | |
| What exactly do you mean with "pass down"? If the module is in a separate file, you'll likely have to pass it in some way, but if it's in the same file it is also in the scope, so you don't need to pass it | 22:05:29 | |
I'm talking about myModule - same way im passing in lib. | 22:05:49 | |
| Oh no, not in that way | 22:05:57 | |
| Give me a sec, I'll try to write a quick example | 22:06:07 | |
| https://gist.github.com/CRTified/69f83b3c1eef037413a400566e583cd3 | 22:15:11 | |
| Here you go | 22:15:14 | |
| Both versions are in that flake 🙂 | 22:16:01 | |
In reply to @mib:kanp.aiI think this works, but I also need pass in the nixpkgs lib and the magic nixosModules config attribute somehow | 22:16:05 | |
* https://gist.github.com/CRTified/69f83b3c1eef037413a400566e583cd3 Note that the externalModule.nix contains a function taking self which returns the usual module (which is a function in config, lib, ...) | 22:17:35 | |
tbh, I don't know whether the let/inherit approach or the higher-order-function approach is better, but nix evaluates slow either way, so I'd say that it makes sense to use what the user can actually use 🙂 | 22:19:44 | |
In reply to @crtified:crtified.methank you for this ❤️ | 22:20:48 | |
In reply to @janik0:matrix.orgOh, if you need the proper name for that concept: It's a Closure - more obvious with the external module | 22:42:46 | |
In reply to @crtified:crtified.meI'll look into that later. I gave myself the challenge of getting a deeper understating of the nix lang and nixos module system so I'm Implementing a dns libary a module which gives necessary meta information to generate something like a octodns config. | 22:49:11 | |
Download image.png | 22:49:25 | |
| oh, dns name manipulation might come handy once in a while 🙂 | 22:49:53 | |
In reply to @janik0:matrix.orgNice idea! I hope you share it once you're done! :) | 22:53:15 | |
In reply to @janik0:matrix.orgdunno about closure approach but you could merge them; nixpkgs.lib // (import ./lib) | 22:54:06 | |
* dunno about closure approach but you could merge them; lib = nixpkgs.lib // (import ./lib) | 22:54:28 | |
In reply to @crtified:crtified.meAh, yeah, so it is either the inherit (because external file) or inlining a closure. I prefer passing an attribute set to generate the module since the actual module is in another file, but to each their own :) (also makes it easier if you e.g. have a bunch of modules) | 22:57:17 | |
| Thanks for the example though! :) always nice to see alternative ways of solving issues ^^ | 22:57:47 | |
* you could merge them; lib = nixpkgs.lib // (import ./lib). Works with both closure and passing the attributeset, but you'll probably want a let in regardless | 22:58:39 | |
In reply to @crtified:crtified.me* I'll look into that later. I gave myself the challenge of getting a deeper understating of the nix lang and nixos module system so I'm Implementing a dns libary and module which gives necessary meta information to generate something like a octodns config. | 22:58:46 | |
In reply to @mib:kanp.aiof course, how else would I get people to do free qa :D | 23:00:57 | |
In reply to @janik0:matrix.orgOoooh, that does look pretty excellent! I’m skeptical of the proxy approach too, and I even more dislike having transitive deps inject those into my system dependencies… so today I switched from Eza to lsd (: | 23:37:47 | |
| 9 Nov 2023 | ||
| Hi, a friend just released a very small flake-parts module extension around perSystem in case someone wants to give it a try :3 https://github.com/vic/fp-nm-ws | 05:38:57 | |
| 06:33:38 | ||