I’m using deploy-rs to deploy my systems with a flake config, and I’m trying to get the netdata module from unstable into my configuration.
I can use disableModules to skip importing the netdata module, but I don’t know how to import the one from unstable.
There’s modulesPath but that refers to the path of the “base” nixpkgs.
Maybe I’m missing something, but can’t you add an additional input to your flake called nixpkgs-unstable that tracks unstable, and wrap you ./configuration.nix in another function that passes this in?
In configuration.nix:
{ nixpkgs-unstable }:
{ config, pkgs, ... }:
{
# use the module here I guess?
}
Right so I already have unstable as an input to my flake, but I don’t know how to get to the module definition from the flake. It’s not an attribute, or at least I can’t find it.
modulesPath gives you the filesystem location of the main nixpkgs flake, so that you can read files from there, but there’s no modulesPath for nixpkgs-unstable, I think?
I don’t like this approach though because it adds another function call layer. I’m actually passing all in my inputs to my NixOS configurations as specialArgs in flake.nix to the module system:
The specialArgs way of doing it instead of an overlay is what I use now, but I used the way described in that URL (an overlay) without issue for a good while.
Thanks all! So the solution is twofold: interpolate the flake to get the path, and pass the flake as module attributes.
The specialArgs approach is great, I didn’t know about it, but it’s very undiscoverable and in the modules also provides magic attributes which is bad for me in the future that forgot about them. I’ll name those added arguments like specialArgs.specialArgs-inputs = inputs; so that it’s clearer in the module sources.