{ lib, config, inputs, ... }:

with lib;

let
  cfg = config.settings.desktop-environments.cosmic;
in {
  options = {
    settings.desktop-environments.cosmic.enable = lib.mkOption {
      type = lib.types.bool;
      description = ''
        Enable cosmic desktop environment
      '';
    };
  };

  imports = [
    inputs.nixos-cosmic.nixosModules.default
  ];

  config = mkIf cfg.enable {
    services.desktopManager.cosmic.enable = true;

    environment.sessionVariables = {
      COSMIC_DISABLE_DIRECT_SCANOUT = "true";
    };
  };
}
