{ lib, ... }:
{
  services = {
    auto-cpufreq = {
      enable = false;
      settings = {
        # settings for when connected to a power source
        charger = {
          # see available governors by running: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
          # preferred governor
          governor = "schedutil";

          # minimum cpu frequency (in kHz)
          # example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000
          # Available: 912 MHz, 1284 MHz, 1752 MHz, 2004 MHz, 2256 MHz, 2424 MHz
          # 702000 948000 1188000 1452000 1704000 1968000 2208000 2400000 2568000 2724000 2868000 3000000 3132000 3264000
          # see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html
          # to use this feature, uncomment the following line and set the value accordingly
          scaling_min_freq = 912000;
          scaling_max_freq = 3500000;
          # scaling_min_freq = 702000;
          # scaling_max_freq = 1968000;

          # turbo boost setting. possible values: always, auto, never
          turbo = "auto";
        };
        # settings for when using battery power
        battery = {
          # see available governors by running: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
          # preferred governor
          governor = "powersave";

          # minimum cpu frequency (in kHz)
          # example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000
          # Available: 912 MHz, 1284 MHz, 1752 MHz, 2004 MHz, 2256 MHz, 2424 MHz
          # 702000 948000 1188000 1452000 1704000 1968000 2208000 2400000 2568000 2724000 2868000 3000000 3132000 3264000
          # see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html
          # to use this feature, uncomment the following line and set the value accordingly
          scaling_min_freq = 912000;
          scaling_max_freq = 2424000;

          # turbo boost setting (always, auto, or never)
          turbo = "auto";

          # battery charging threshold
          # reference: https://github.com/AdnanHodzic/auto-cpufreq/#battery-charging-thresholds
          #enable_thresholds = true
          #start_threshold = 20
          #stop_threshold = 80
        };
      };
    };

    displayManager = {
      sddm = {
        enable = lib.mkForce true;
        wayland.enable = lib.mkForce true;
      };
      gdm.enable = lib.mkForce false;
    };

    desktopManager = {
      plasma6.enable = lib.mkForce false;
      gnome.enable = lib.mkForce false;
    };

    logind = {
      settings = {
        Login = {
          HandleLidSwitchExternalPower = "ignore";
          HandleLidSwitch = "suspend";
          HandlePowerKeyLongPress = "poweroff";
          HandlePowerKey = "suspend";
        };
      };
    };

    # Enable Flatpak
    flatpak.enable = lib.mkDefault false;

    gvfs.enable = true;

    keyd = {
      enable = false;
      keyboards = {
        default = {
          ids = [ "*" ];
          settings = {
            main = {
              # Use ⌘ key (leftmeta) to activate macOS-like layer
              leftmeta = "layer(meta_mac)";
            };

            meta_mac = {
              # Tab switching
              tab = "swapm(app_switch_state, M-tab)";
              "`" = "A-f6";

              # App shortcuts
              c = "C-insert"; # Copy
              v = "S-insert"; # Paste
              x = "S-delete"; # Cut

              "1" = "A-1";
              "2" = "A-2";
              "3" = "A-3";
              "4" = "A-4";
              "5" = "A-5";
              "6" = "A-6";
              "7" = "A-7";
              "8" = "A-8";
              "9" = "A-9";

              # Move to line start/end
              left = "home";
              right = "end";
            };

            app_switch_state = {
              tab = "M-tab";
              right = "M-tab";
              "`" = "M-S-tab";
              left = "M-S-tab";
            };
          };
        };
      };
    };
  };
}
