{
  lib,
  config,
  pkgs,
  ...
}: let
  inherit (lib) mkIf mkForce;
  inherit (config) conf versions;
  time = pkgs.makeDesktopItem {
    name = "peaclock-desktop";
    desktopName = "Time";
    exec = "alacritty -e ${pkgs.peaclock}/bin/peaclock";
  };
in
  mkIf (conf.host != "server") {
    # Audio
    security.rtkit.enable = true;

    services = {
      pipewire = {
        enable = true;
        alsa.enable = true;
        alsa.support32Bit = true;
        pulse.enable = true;
        jack.enable = mkForce false;

        extraConfig.pipewire = {
          "90-hifi" = {
            "context.properties" = {
              "default.clock.rate" = 384000;
            };
          };
        };
      };
      # Needed for some features in nautilus such as auto-mounting and trash
      gvfs.enable = true;
    };

    # Run statically linked and more
    environment.systemPackages = [pkgs.nix-alien];
    programs.nix-ld.enable = true;

    # Bluetooth
    hardware.bluetooth = {
      enable = true;
      powerOnBoot = true;
      settings = {
        General = {
          Enable = "Source,Sink,Media,Socket";
          Experimental = true;
        };
      };
    };

    hardware.opentabletdriver.enable = true;

    # Regularly clean download folder
    systemd = {
      timers."clean-download" = {
        wantedBy = ["timers.target"];
        timerConfig = {
          OnCalendar = "*-*-* 03:00:00";
          Unit = "clean-download.service";
        };
      };

      services."clean-download" = {
        script = ''
          ${pkgs.coreutils}/bin/rm -rf /home/${conf.username}/Downloads/*
        '';
        serviceConfig = {
          Type = "oneshot";
          User = "root";
        };
      };
    };

    services.blueman.enable = true;

    home-manager.users.${conf.username} = {
      home = {
        packages = with pkgs;
          [
            adwaita-icon-theme
            adwaita-qt
            adwaita-qt6

            loupe
            spotify
            amberol
            snapshot
            papers

            nautilus
            gnome-disk-utility
            fragments

            krita
            gimp
            inkscape
            libresprite
            tor-browser
            chromium
            libreoffice-qt6
            prusa-slicer
            ghidra
            peaclock
            (cutter.withPlugins (ps:
              with ps; [
                jsdec
                sigdb
                rz-ghidra
              ]))

            signal-desktop
            vesktop
            element-desktop
            fractal
          ]
          ++ [
            time
          ];

        file = {
          ".config/vesktop/settings.json" = {
            source = ./vesktop.conf.json;
          };
          ".config/vesktop/settings/settings.json" = {
            source = ./vencord.conf.json;
          };
        };

        pointerCursor = rec {
          gtk.enable = true;
          x11.enable = true;
          name = "BreezX-RosePine-Linux";
          size = 24;
          package = pkgs.callPackage ./cursor.nix {
            name = name;
            version = versions.rosepine-cursor;
          };
        };
      };

      qt = {
        enable = true;
        platformTheme.name = "adwaita";
        style.name = "adwaita-dark";
      };

      gtk = {
        enable = true;
        gtk4.extraConfig = {
          gtk-application-prefer-dark-theme = true;
        };
        gtk3.extraConfig = {
          gtk-application-prefer-dark-theme = true;
        };
        gtk2.extraConfig = "gtk-application-prefer-dark-theme=1\n";
        theme.name = "Adwaita Dark";
      };

      dconf = {
        enable = true;
        settings = {
          "org/gnome/desktop/interface" = {
            color-scheme = "prefer-dark";
          };
        };
      };

      programs = {
        firefox = import ./firefox.conf.nix pkgs;

        thunderbird = {
          enable = true;
          profiles = {
            "default" = {
              isDefault = true;
            };
          };
        };

        mpv.enable = true;

        pandoc.enable = true;

        alacritty = {
          enable = true;
          settings = import ./alacritty.conf.nix config;
        };
      };
    };
  }
