It’s also possible without flake-parts, for the record:
# blackbox.nix
#
# To be imported by a *NixOS*, not home-manager
# or flake-parts, module.
{ config, lib, ... }:
let
cfg = config.d.programs.blackbox;
in
{
options.d.programs.blackbox = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
pkgs.blackbox-terminal
];
home-manager.sharedModules = [(
# Just showing we *can* get `osConfig`,
# `config` is still in scope, and the entire
# module import is scoped behind
# `cfg.enable`, so we don't actually need it.
#
# It's more useful if we also want to access
# home-manager's `config`.
{ osConfig, lib, ... }: {
dconf.settings = {
"com/raggesilver/BlackBox" = with lib.hm.gvariant; {
fill-tabs = false;
# ... more settings
};
};
}
)];
};
}
flake-parts can be nice for other things, but it’s superfluous here and just makes you write more.
I’m a lil’ worried that people are apparently completely misunderstanding the module system. NixOS is a module system, you don’t need to add flake-parts on top to get module resolution. I know the “dendritic” model is all the rage, but I honestly don’t understand how so many people can have the same misunderstanding. It feels like one big mass hallucination.