But I need to get more generic things straight at this point, so questions I got on my mind:
Is there a way to call nix-build to the module and not to the package expression?
Lets say my config tells hardware.sane.backends.brscan.enable = true; and also hands some config… how would I call my module manually with those informations?
If I change my package/module, under what circumstances would nixos decide to rebuild it?
do I need to bump my version? Modules don’t have a version right?
do I need to set a --force flag somehow?
is there some printf stuff for debugging that I could add to my expressions so I could checkin with intermediate informations during building the package?
oh boy, every start is a hard one, isnt it?
This is just one example of several that all failed, it took me about TWO hours to find the solution… development is such a humbling experience
But thank you, got the debug.traceVal example working here.
About the other question I had previously… you came back with: “and build what exactly?”
Let me rephrase it:
I want to package a software and build a module to configure the software declaritively from nixos/config.nix → correct? we are on the same page? if not, that would indicate me I am mixing up some semantics.
i do end up with a expression that describes my package and another expression that describes a config module - i think…
So while I am dev’ing I would like to test the build again and again in a quick manner, instead of calling the lengthy (and chatty) process of nixos-rebuild test.
In other words: i want to call the build the same was nixos-rebuild does when I enable a package via config modules.
I would like to draft that with some pseudo code:
nix-build ./pkgs/my-printer-driver/ { hardware.config.sane.backends.brscan3.enable = true }
that should pull my package, build it and put configs from my input as if a declared that globally in my nixos/config.nix
If you’re trying to test a NixOS module, you can create a NixOS VM test or even just create a separate test config which imports your moduleand build that (of course don’t deploy it)