Vscode not opening GitHub Sign In to activate syncing

This is my pretty basic NixOS configuration file:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos"; # Define your hostname.
  networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Make wireless interface unmanaged (in order to make WiFi work)
  networking.networkmanager.unmanaged = ["wlan*" "wlp*"];

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Europe/Rome";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "it_IT.UTF-8";
    LC_IDENTIFICATION = "it_IT.UTF-8";
    LC_MEASUREMENT = "it_IT.UTF-8";
    LC_MONETARY = "it_IT.UTF-8";
    LC_NAME = "it_IT.UTF-8";
    LC_NUMERIC = "it_IT.UTF-8";
    LC_PAPER = "it_IT.UTF-8";
    LC_TELEPHONE = "it_IT.UTF-8";
    LC_TIME = "it_IT.UTF-8";
  };

  # Configure keymap in X11
  services.xserver = {
    layout = "it";
    xkbVariant = "";
  };

  # Configure console keymap
  console.keyMap = "it2";

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.frollo = {
    isNormalUser = true;
    description = "Frollo";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [];
  };

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
    alacritty
    firefox-devedition-bin
    git
    waybar
    rofi-wayland
    vscode
  ];

  # Enable programs
  programs.hyprland.enable = true;
  programs.thunar.enable = true;
  #programs.vscode.enable = true;

  # XDG sesttings
  xdg.portal.enable = true;
  xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
  ## Setting default browser
  xdg.mime.enable = true;
  #xdg.mime.defaultApplications = {
  #  "text/html" = "firefox-developer-edition.desktop";
  #  "x-scheme-handler/http" = "firefox-developer-edition.desktop";
  #  "x-scheme-handler/about" = "firefox-developer-edition.desktop";
  #  "x-scheme-handler/https" = "firefox-developer-edition.desktop";
  #  "x-scheme-handler/unknown" = "firefox-developer-edition.desktop";
  #}
  #xdg.mimeApps.enable = true;
  #xdg.associations.added = {
  #  "text/html" = ["firefox-developer-edition.desktop"];
  #  "x-scheme-handler/http" = ["firefox-developer-edition.desktop"];
  #}
  #environment.sessionVariables.DEFAULT_BROWSER = "${pkgs.firefox-devedition-bin}/bin/firefox-developer-edition"

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "23.11"; # Did you read the comment?

}

Problem: I open vscode, I press on the user icon and “Backup and sync settings…”, then I choose GitHub as login method, the pop up “Signing in to github.com…” appears and stays there forever. If I press “Cancel”, I get

You have not yet finished authorizing this extension to use GitHub. Would you like to try a different way? (local server)

Source: GitHub Authentication (Extension)

As you can see in the configuration I tried to change the xdg MIME settings (because I thought it was a default browser problem), but if I uncomment the any of those lines I get an error while running nixos-rebuild switch. Here is some possibly useful output:

ls /run/current-system/sw/share/applications/
Alacritty.desktop                  rofi.desktop
code.desktop                       rofi-theme-selector.desktop
code-url-handler.desktop           thunar-bulk-rename.desktop
firefox-developer-edition.desktop  thunar.desktop
mimeinfo.cache                     thunar-settings.desktop
nixos-manual.desktop               xdg-desktop-portal-gtk.desktop
org.freedesktop.Xwayland.desktop
cat /run/current-system/sw/share/applications/mimeinfo.cache
[MIME Cache]
application/vnd.mozilla.xul+xml=firefox-developer-edition.desktop;
application/xhtml+xml=firefox-developer-edition.desktop;
inode/directory=code.desktop;thunar.desktop;
text/html=firefox-developer-edition.desktop;
text/plain=code.desktop;
text/xml=firefox-developer-edition.desktop;
x-scheme-handler/http=firefox-developer-edition.desktop;
x-scheme-handler/https=firefox-developer-edition.desktop;
x-scheme-handler/vscode=code-url-handler.desktop;

So it doesn’t look like to me it’s an xdg error. Probably the issue is simpler than I think. Any help is appreciated.

1 Like

Using the “different method (local server)” works for me, but yea, it would be nice if it worked with the default method.

I solved this. Just install xdg-utils. It will allow the syncing. You need also to install a keyring package like pass, otherwise it will sync extensions with “weaker encryption”.