{
  config,
  pkgs,
  system,
  namespace,
  hasDestopEnvironment ? true,
  ...
}:
let
  isArm = ("aarch64-linux" == system) || ("aarch64-darwin" == system);

  x86_only = with pkgs; [
    vscode-extensions.redhat.vscode-xml
  ];
  open-remote-ssh = pkgs.${namespace}.open-remote-ssh;
in
{
  home.packages = with pkgs; [
    nodePackages.nodejs
    uv
  ];

  programs = {
    vscode = {
      enable = hasDestopEnvironment;
      package = pkgs.vscodium;
      mutableExtensionsDir = false;
      profiles = {
        default = {
          enableUpdateCheck = false;
          enableExtensionUpdateCheck = false;
          extensions =
            with pkgs;
            [
              vscode-extensions.arrterian.nix-env-selector
              vscode-extensions.bbenoist.nix
              vscode-extensions.brettm12345.nixfmt-vscode
              vscode-extensions.cweijan.vscode-database-client2
              # vscode-extensions.dendron.dendron-markdown-preview-enhanced
              vscode-extensions.jnoortheen.nix-ide
              vscode-extensions.mkhl.direnv
              vscode-extensions.ms-python.debugpy
              vscode-extensions.ms-python.pylint
              vscode-extensions.ms-python.python
              # vscode-extensions.ms-python.vscode-pylance
              vscode-extensions.redhat.vscode-yaml
              vscode-extensions.yy0931.vscode-sqlite3-editor

              # open-remote-ssh
              # nix-vscode-extensions.open-vsx.jeanp413.open-remote-ssh
              open-remote-ssh
            ]
            ++ (if !isArm then x86_only else [ ])
            ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
              {
                name = "copilot-mcp";
                publisher = "automatalabs";
                version = "0.0.49";
                sha256 = "sha256-+G2OQl5SCN7bh7MzGdYiRclIZefBE7lWnGg1kNpCvnA=";
              }
              {
                name = "mcp-server-runner";
                publisher = "zebradev";
                version = "0.1.0";
                sha256 = "sha256-StydVt3VzQUSS/pYp76jnIwtZlEj8gWAGzOARs93J+E=";
              }
              {
                name = "claude-dev";
                publisher = "saoudrizwan";
                version = "3.17.9";
                sha256 = "sha256-y3bFtMe5vZrO3DFb31KDvkzjD2jM76wK89mKhgJXC70=";
              }
            ];

          userSettings = {

            "editor" = {
              "defaultFormatter" = "brettm12345.nixfmt-vscode";
              "fontFamily" = "fira-code-nerd, FiraCode Nerd Font, Consolas, 'Courier New', monospace";
              "fontLigatures" = true;
              "renderWhitespace" = "all";
            };

            "explorer" = {
              "confirmDelete" = false;
              "confirmDragAndDrop" = false;
            };

            "git" = {
              "confirmSync" = false;
              "enableSmartCommit" = true;
            };

            "github" = {
              "copilot.nextEditSuggestions.enabled" = true;
              "copilot.enable" = {
                "nix" = true;
              };
            };

            "[json]" = {
              "editor.defaultFormatter" = "vscode.json-language-features";
            };

            "nix" = {
              "enableLanguageServer" = true;
              "formatterPath" = "nixpkgs-fmt";
              "serverPath" = "nixd";
              "serverSettings" = {
                "nixd" = {
                  "formatting" = {
                    "command" = [ "nixpkgs-fmt" ];
                  };
                  "options" = {
                    # By default, this entriy will be read from `import <nixpkgs> { }`.
                    # You can write arbitary Nix expressions here, to produce valid "options" declaration result.
                    # Tip: for flake-based configuration, utilize `builtins.getFlake`
                    "nixos" = {
                      "expr" =
                        "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").nixosConfigurations.<name>.options";
                    };
                    "home-manager" = {
                      "expr" =
                        "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").homeConfigurations.<name>.options";
                    };
                    # # Tip: use ${workspaceFolder} variable to define path
                    # "nix-darwin" = {
                    #   "expr" = "(builtins.getFlake \"${workspaceFolder}/path/to/flake\").darwinConfigurations.<name>.options"
                    # }
                  };
                };
              };
            };

            "[nix]" = {
              "editor" = {
                "defaultFormatter" = "brettm12345.nixfmt-vscode";
                "tabSize" = 2;
              };
            };

            "security.workspace.trust.untrustedFiles" = "open";

            "workbench" = {
              "colorCustomizations" = null;
              "editorAssociations" = {
                "*.db" = "default";
              };
            };

            "enable-proposed-api" = [ "jeanp413.open-remote-ssh" ];
          };
        };
      };
    };
    direnv = {
      enable = true;
      nix-direnv.enable = true;
      enableZshIntegration = true;
    };
  };
}
