How to enable unfree packages for nix-vscode-extensions?

Hi. I’m using nix-vscode-extensions and for the sake of god I can’t figure out how to install unfree extensions like ms-vscode-remote.remote-ssh.

In my flake.nix (see below, removed unnecessary stuff) I set allowUnfree = true; for pkgs. My home-manager also has useGlobalPkgs = true; set. I can install unfree packages without a problem. But for vscode extensions this doesn’t seem to work.

The readme of nix-vscode-extensions also mentions to just set allowUnfree for pkgs.

I have no idea what is going on here. Can someone please help me? I tried multple times to fix this but never managed to make any progress and falled back to using NIXPKGS_ALLOW_UNFREE=1 which works but is not really a solution I guess.

       error: Package ‘vscode-extension-ms-vscode-remote-remote-ssh-0.121.2025050915’ in /nix/store/k6hfjkc337ik8l6snfd5q4b7b0flw3py-ninkaf94v6231yv0pyx401zfsw8pkxxx-source/pkgs/applications/editors/vscode/extensions/ms-vscode-remote.remote-ssh/default.nix:101 has an unfree license (‘unfree’), refusing to evaluate.

       a) To temporarily allow unfree packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNFREE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnfree = true; }
       in configuration.nix to override this.

       Alternatively you can configure a predicate to allow specific packages:
         { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
             "vscode-extension-ms-vscode-remote-remote-ssh"
           ];
         }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnfree = true; }
       to ~/.config/nixpkgs/config.nix.
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05";
    nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager?ref=release-25.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
  };

  outputs = inputs@{
    self,
    nixpkgs,
    nixpkgs-unstable,
    ...
  }:
  let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      config.allowUnfree = true;
    };
    pkgs-unstable = import nixpkgs-unstable {
      inherit system;
      config.allowUnfree = true;
    };
    commonArgs = { inherit self inputs pkgs-unstable; };
  in
  {
    nixosConfigurations = {
      nixos-playground = inputs.nixpkgs.lib.nixosSystem {
        specialArgs = commonArgs;
        modules = [ ./hosts/nixos-playground ];
      };
    };
  };
}
{
  inputs,
  pkgs,
  ...
}: let
  marketplace = inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace;
in {
  _module.args.marketplace = marketplace;

  home-manager.users.mentos.programs.vscode = {
    enable = true;
    mutableExtensionsDir = false;

    # Extensions
    extensions = with marketplace; [
      ms-vscode-remote.remote-ssh
    ];
  };
}

You didn’t. You set it for an unused binding.

Put that in a NixOS module:

nixpkgs.config.allowUnfree = true;