nixos/home/david/modules/programs/niri/default.nix

94 lines
2.1 KiB
Nix
Raw Normal View History

{
config,
lib,
inputs,
pkgs,
2025-11-10 19:28:58 +08:00
osConfig ? (throw "Trying to access osConfig, the home-manager module is not being used in the nixos module"),
2025-07-06 08:58:26 +08:00
options,
...
2025-11-10 19:28:58 +08:00
}: let
cfg = config.david.programs.niri;
in {
2025-11-10 19:28:58 +08:00
imports = [
./config.nix
];
options = {
david.programs.niri = {
enable =
(lib.mkEnableOption "niri")
// {
default = osConfig.youthlic.gui.enabled == "niri";
};
2025-11-10 19:28:58 +08:00
config = lib.mkOption {
type = inputs.niri-flake.lib.kdl.types.kdl-document;
};
2025-07-06 08:58:26 +08:00
wluma.extraSettings = lib.mkOption {
inherit (options.david.programs.wluma.extraSettings) type;
};
2025-07-13 06:04:55 +08:00
waybar = {
template = lib.mkOption {
readOnly = true;
type = lib.types.anything;
default = config.david.programs.waybar.template;
};
helper = lib.mkOption {
readOnly = true;
type = lib.types.anything;
default = config.david.programs.waybar.helper;
};
settings = lib.mkOption {
inherit (options.david.programs.waybar.settings) type;
};
};
};
};
2025-05-03 23:23:02 +08:00
config = lib.mkMerge [
2025-07-13 06:04:55 +08:00
(lib.mkIf cfg.enable {
2025-11-10 19:28:58 +08:00
home.packages = with pkgs; [
swaynotificationcenter
wl-clipboard
cliphist
swayimg
seahorse
];
xdg.configFile = let
2025-11-10 19:28:58 +08:00
qtctConf = ''
[Appearance]
standard_dialogs=xdgdesktopportal
'';
in {
2025-11-10 19:28:58 +08:00
"qt5ct/qt5ct.conf" = {
text = qtctConf;
};
2025-11-10 19:28:58 +08:00
"qt6ct/qt6ct.conf" = {
text = qtctConf;
2025-07-01 23:17:40 +08:00
};
};
2025-07-13 06:04:55 +08:00
david.programs = {
fuzzel.enable = true;
waybar = {
enable = true;
inherit (cfg.waybar) settings;
2025-07-01 23:17:40 +08:00
};
2025-07-13 06:04:55 +08:00
wluma = {
enable = true;
inherit (cfg.wluma) extraSettings;
2025-05-03 23:23:02 +08:00
};
2025-07-13 06:04:55 +08:00
swaync.enable = true;
swaylock.enable = true;
waypaper.enable = true;
kanshi.enable = true;
};
programs.niri = {
2025-11-10 19:28:58 +08:00
inherit (cfg) config;
2025-07-13 06:04:55 +08:00
};
})
(lib.mkIf (!cfg.enable) {
programs.niri = {
settings = null;
config = null;
};
})
2025-05-03 23:23:02 +08:00
];
}