Issue with Nix profile install unfree (flake install)

AFAIK this should work
based on the other discourse discussions on the flakes+unfree:

NIXPKGS_ALLOW_UNFREE=1 nix profile install --impure 'https://github.com/NixOS/nixpkgs/archive/122adac3284a1ab0d987bf607286c7b10c34b984.tar.gz#android-studio'         

However it doesn’t:

error:
       … in the condition of the assert statement

         at /nix/store/kr923m2kndz51k6cijlx8ja31917j2fx-source/lib/customisation.nix:365:17:

          364|     in commonAttrs // {
          365|       drvPath = assert condition; drv.drvPath;
             |                 ^
          366|       outPath = assert condition; drv.outPath;

       … while evaluating the attribute 'handled'

         at /nix/store/kr923m2kndz51k6cijlx8ja31917j2fx-source/pkgs/stdenv/generic/check-meta.nix:507:7:

          506|       # or, alternatively, just output a warning message.
          507|       handled =
             |       ^
          508|         (

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Package ‘android-studio-stable-2024.2.1.9’ in /nix/store/kr923m2kndz51k6cijlx8ja31917j2fx-source/pkgs/applications/editors/android-studio/common.nix:273 is not available on the requested hostPlatform:
         hostPlatform.config = "aarch64-apple-darwin"
         package.meta.platforms = [
           "x86_64-linux"
         ]
         package.meta.badPlatforms = [ ]
       , refusing to evaluate.

       a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=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.allowUnsupportedSystem = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnsupportedSystem = true; }
       to ~/.config/nixpkgs/config.nix.

Any ideas? I’ve tried moving the --impure to all different locations, but the example above was the only valid location I found.

The repo of nixpkgs-unfree doesn’t work since I need to grab a pinned version and the github hashes are different.

did you read the error? it says the package isn’t supported on your system.

         hostPlatform.config = "aarch64-apple-darwin"
         package.meta.platforms = [
           "x86_64-linux"
         ]

You are trying to install a package that marks itself as “64bit Intel/AMD compatible CPUs with a Linux kernel” only.

Try a VM.