Sender | Message | Time |
---|---|---|
17 Apr 2024 | ||
nbp | In reply to @infinidoge:matrix.orgThe module system has its own test suite under nixpkgs/lib/tests , the modules directory contains tons of tiny modules, and the modules.sh combine them in various way to check for the expected outcomes. | 10:29:33 |
Robert Hensing (roberth) | In reply to @lorenzleutgeb:matrix.orgSounds like what the flake.parts site is doing. It's currently a single evaluation with everything loaded at once, and then split out with this logic: https://github.com/hercules-ci/flake.parts-website/blob/af75b73a9cb306da0789bfd326e214c6103fd646/render/render-module.nix#L81 | 11:33:32 |
Robert Hensing (roberth) | Would be good to make this kind of logic part of the module system proper. I'd like for something like that to be available in the module system library, and if someone wants to take that code and add tests, that'd be fine with me | 11:36:12 |
Lorenz Leutgeb | In reply to @roberthensing:matrix.orgLooks like you are processing all (many, in my case including all of NixOS) options at once, and are then only filtering the result. This requires some "external data" (=the criteria for the filter). I ended up doing something similar: Couple every path of a file that defines a module with a regex that matches the options I expect to extract from it. Both our solutions are quite easy to implement, but what I was asking for goes a little further, i.e. to let the module system expose such filtering possibility. | 11:42:16 |
Robert Hensing (roberth) | Seems we're asking for the same thing then :) | 11:54:45 |
ibizaman | nbp well, congrats! Because it’s a damn good system indeed! :clap: | 14:00:26 |
ibizaman | In reply to @infinidoge:matrix.orgIn my repo I’m having module tests (example) with evalModule and integration tests (example) with nixosTests and it’s all run together with flake checks. | 14:06:08 |
ibizaman | In reply to @nbp:mozilla.orgIf you prefer a written version of the talk (which is not cut at the end) you can read here :) https://shb.skarabox.com/contracts.html | 14:08:07 |
@infinidoge:matrix.org | In reply to @ibizaman:matrix.orgI more so mean ad-hoc testing of random module things, as opposed to proper module tests, however that is something I should also do | 14:17:03 |
ibizaman | In reply to @infinidoge:matrix.orgAh I see. The only other example I can offer is related to testing functions like here. That being said, it’s also written tests. I can’t think of an intermediate way between this and load in the repl, even outside of nix modules. | 14:20:17 |
@infinidoge:matrix.org | I think me using the word 'testing' is too loaded of a term lol | 14:23:04 |
@infinidoge:matrix.org | I just mean messing around like you would with a repl :) | 14:23:28 |
@infinidoge:matrix.org | It's just that defining and working with modules in the repl gets a bit annoying so I usually shove it in my NixOS configuration and let that eval the module | 14:24:04 |
ibizaman | Aaah yes. Got it. I agree I missed something to do that a few times. My only way is like you said, to use the module somewhere else and run nix build on it or something | 14:34:04 |
ibizaman | * Aaah yes. Got it. I agree. I missed something to do that a few times. My only way is like you said, to use the module somewhere else and run nix build on it or something | 14:34:28 |
JoelMcCracken joined the room. | 16:28:10 | |
@djacu:matrix.org | In reply to @nbp:mozilla.orghah thanks! If I had more time, mkIf would have probably been the next topic.Also link to all the lessons if you want to share -> https://nixos-modules.nix.みんな/ | 19:40:02 |
18 Apr 2024 | ||
nbp | I guess, I might be completely biais into introducing mkIf early, as it feels like a must have for implementing modules in NixOS, but I think your plan might actually make more sense from a user point of view and might be better to target non-developer, who might appreciate the lack of conditional. | 00:44:32 |
nbp | * I guess, I might be completely biais into introducing mkIf early, as it feels like a must have for implementing modules in NixOS. On the other hand I think your plan might actually make more sense from a user point of view and might be better to target non-developer, who might appreciate the lack of conditional. | 00:45:09 |
@djacu:matrix.org | In reply to @nbp:mozilla.org I'd say everything I have in the "Getting Started" section must come first as it lays the foundation for how a module can be created. Anything after that is fair game. Does documentation need to come so early? Nah but it's a quick one and a good thing to reinforce that people should document their modules well. I had the types section in there because I wanted to get to submodules as it is the most ubiquitous and a very powerful type.
| 02:05:29 |
@djacu:matrix.org | The only issue I see with introducing mkIf early is that there needs to be a sufficient foundation so that you don't introduce anything extra. All the lessons are in an order such that only 1 or 2 new things are introduced. My hope is that this keeps the reader focused on what is currently trying to be taught and they don't have to juggle any extra information in their head. | 02:07:23 |
19 Apr 2024 | ||
hexa | infinisil: https://github.com/NixOS/nixpkgs/pull/305334#issuecomment-2067069655 can you answer this? | 18:44:37 |
infinisil | In reply to @hexa:lossy.network☑️ | 18:50:31 |
hexa | thansk! | 18:50:36 |
hexa | * thanks! | 18:50:41 |
22 Apr 2024 | ||
@djacu:matrix.org | Is there a way I can circumvent the Two attributes I've implemented so far are Trying to think of a good solution but coming up empty. Any ideas? | 06:19:34 |
@infinidoge:matrix.org | You probably want either the anything option type, or to define your own types | 08:29:40 |
nbp | Why using submodules if you have only a single instance of each attribute? | 10:28:26 |
nbp | You can declare options to be unused: https://github.com/NixOS/nixpkgs/blob/8e54038847aa80ee2b1ffa9e313b0ab918f1903c/lib/options.nix#L228-L244 But I do not think this answer your problem. One example of usage of it is from this PR: https://github.com/NixOS/nixpkgs/pull/152785/files | 10:36:38 |
nbp | Maybe you can use the type nullOr and have a default value of null . | 10:37:54 |