{ inputs, den, pkgs, ... }: {
  den.aspects.niri.nixos = { pkgs, ... }:
  let
    quickshell-niri = inputs.qml-niri.packages.${pkgs.stdenv.hostPlatform.system}.quickshell;
  in {
    imports = [ inputs.niri-flake.nixosModules.niri ];

    fonts.packages = [ pkgs.nerd-fonts.jetbrains-mono ];

    programs.niri.enable = true;

    programs.gpu-screen-recorder.enable = true;

    environment.systemPackages = with pkgs; [
      quickshell-niri
      xdg-desktop-portal-gnome
      xwayland-satellite
      gpu-screen-recorder-gtk
    ];
 
    xdg.portal = {
      enable       = true;
      extraPortals = [
        pkgs.xdg-desktop-portal-gnome
        pkgs.kdePackages.xdg-desktop-portal-kde
      ];
      config.common.default = [ "gnome" ];
    };

    # Without a full Plasma session, kbuildsycoca6 has no XDG applications
    # menu to build KServices from, so Dolphin can't resolve default apps and
    # fails to open files with KDE apps (ark/gwenview) — "org.kde.ark was not
    # found". Ship the Plasma menu under both names it may be looked up as
    # (XDG_MENU_PREFIX=plasma- expects plasma-applications.menu).
    # https://github.com/NixOS/nixpkgs/issues/409986
    environment.etc = {
      "xdg/menus/applications.menu".source =
        "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
      "xdg/menus/plasma-applications.menu".source =
        "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
    };

    security.pam.services.swaylock = {};

    services.greetd = {
      enable = true;
      settings.default_session = {
        command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd niri-session";
        user    = "greeter";
      };
    };
  };
}
