{ ... }:
{
  _class = "clan.service";
  manifest.name = "emmie-home-manager";
  manifest.description = "Emmie's home-manager profile generator";
  manifest.readme = "Emmie's home-manager profile generator";
  manifest.categories = [ "System" ];

  roles.default = {
    description = "a default role for the user";
    perInstance =
      { ... }:
      {
        nixosModule =
          { inputs, pkgs, ... }:
          let
            username = "emmie";
          in
          {
            imports = [ inputs.home-manager.nixosModules.home-manager ];

            users.users.${username} = {
              initialPassword = "";
              isNormalUser = true;
              extraGroups = [
                "audio"
                "video"
                "networkmanager"
              ];
            };

            services.xserver = {
              enable = true;
              xkb.layout = "us,th";
              xkb.options = "grp:win_space_toggle,grp:alt_shift_toggle";
            };

            programs.chromium = {
              enable = true;
              extraOpts = {
                "BlockThirdPartyCookies" = true;
                "ClearBrowsingDataOnExitList" = [
                  "download_history"
                  "cookies_and_other_site_data"
                  "cached_images_and_files"
                  "password_signin"
                  "autofill"
                  "site_settings"
                  "hosted_app_data"
                ];
                "BraveRewardsDisabled" = true;
                "BraveWalletDisabled" = true;
                "BraveAIChatEnabled" = false;
                "BraveNewsDisabled" = true;
                "BraveSpeedreaderEnabled" = false;
                "BraveWaybackMachineEnabled" = false;
                "BraveStatsPingEnabled" = false;
                "BraveWebDiscoveryEnabled" = false;
                "BravePlaylistEnabled" = false;
                "BraveVPNDisabled" = true;
                "TorDisabled" = true;
                "BraveP3AEnabled" = false;
                "BraveTalkDisabled" = true;
                "SyncDisabled" = false;
                "PasswordManagerEnabled" = false;
                "AutofillAddressEnabled" = false;
                "AutofillCreditCardEnabled" = false;
                "TranslateEnabled" = false;
                "DnsOverHttpsMode" = "secure";
                "DnsOverHttpsTemplates" = "https://dns.adguard-dns.com/dns-query";
              };
            };

            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.${username} =
              {
                osConfig,
                pkgs,
                lib,
                inputs,
                ...
              }:
              {
                imports = [ inputs.plasma-manager.homeModules.plasma-manager ];

                home = {
                  homeDirectory = lib.mkForce "/home/${username}";
                  stateVersion = osConfig.system.stateVersion;
                  packages = with pkgs; [
                    libreoffice-fresh
                    element-desktop
                    signal-desktop
                    brave
                    keepassxc
                    vlc
                    thunderbird
                    wasabiwallet
                    protonmail-desktop
                  ];
                };
                programs.chromium.package = pkgs.brave;
                programs.home-manager.enable = true;
                services.syncthing.tray.enable = osConfig.services.syncthing.enable;
                programs.plasma.enable = true;
                programs.plasma.powerdevil = {
                  AC = {
                    autoSuspend.action = "shutDown";
                    autoSuspend.idleTimeout = 1800;
                  };
                  battery = {
                    autoSuspend.action = "shutDown";
                    autoSuspend.idleTimeout = 1800;
                  };
                  lowBattery = {
                    autoSuspend.action = "shutDown";
                    autoSuspend.idleTimeout = 1800;
                  };
                };
              };
            home-manager.extraSpecialArgs = {
              inherit inputs;
            };
          };
      };
  };
}
