I’d like to write a module that combines setting some dconf.settings for my user, and also installs a system-wide package.
Here was my first attempt, a module imported from within config.home-manager.users.${user}
; However, osConfig
is not available within the set passed to mkIf
:
{ osConfig, lib, pkgs, config, user, ... }:
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 {
osConfig.environment.systemPackages = with pkgs; [
blackbox-terminal
];
dconf.settings = {
"com/raggesilver/BlackBox" = with lib.hm.gvariant; {
fill-tabs = false;
# ... more settings
};
};
};
}
I’m open to any ideas, as I’m mostly poking around trying to find a good way forward. Also, it isn’t obvious to me why I can’t access osConfig
here.
Overall, what I’m trying to do is create several individual files, each handling “everything to do with X”, where X might be blackbox-terminal, or firefox, or syncthing. So for example, syncthing might have a system package, and a system service with syncthing devices and folders, as well as a user/home-manager gnome extension, with user/home-manager dconf.settings.
The motivation for this architecture is driven by individual quirks within each package:
- blackbox: is not available as a home-manager program, and must be installed as a systemPackage. But individual properties and configuration are handled by dconf.settings in the home-manager.
- firefox: has policies and better extension UX at the system level, but updated preferences via home-manager.
- syncthing: has declarative devices and folders at the system level, but the gnome extension showing its status must be installed via user gnome extension.
Any suggestions or prior art here?
Thanks.