{ config, lib, ... }:
{
  imports = [
    ./autostart
    ./hotkeys
    ./inputs
    ./outputs
    ./rules
    ./theme
  ];

  options.home.niri.settings = lib.mkOption {
    type = lib.types.attrs;
  };

  config = lib.mkIf config.home.desktop.enable {
    xdg.configFile."niri/config.kdl".text = ''
      ${builtins.readFile config.home.niri.settings.autostart}
      ${builtins.readFile config.home.niri.settings.hotkeys}
      ${builtins.readFile config.home.niri.settings.inputs}
      ${builtins.readFile config.home.niri.settings.outputs}
      ${builtins.readFile config.home.niri.settings.rules}
      ${builtins.readFile config.home.niri.settings.theme}
    '';
  };
}
