Nix develop MacOs aarch64 flake

I’m trying to write a nix flake that produces a shell to compile a tex project from two different systems: One linux x86_64 and one MacOs aarch64-darwin.

I’m quite new to nix and flakes, so I took the example flake given on the nixos wiki “Super fast nix-shell”. It works well on linux x86 but nix develop fails on MacOs and I can’t figure out where is the problem.

Here is my flake.nix:

{
  description = "Build Shell with any dependency of the project";

  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = "github:NixOs/nixpkgs";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let pkgs = nixpkgs.legacyPackages.${system}; 
            tex = pkgs.texlive.combine
              {
                inherit (pkgs.texlive)
                scheme-medium
                pgf
                standalone
                minted
                tcolorbox
                environ
                tabto-ltx
                circuitikz
                lastpage
                tabularray
                pygmentex
                ninecolors
                multirow;
              };
        in
        {
            devShells.default = pkgs.mkShell {
              nativeBuildInputs = [ pkgs.python310Packages.pygments tex ];
          };
        }
      );
}

When using the nix develop command from my mac, I get the following error:

error: flake 'git+file:///PATH_TO_FLAKE' does not provide attribute 'devShells.aarch64-darwin.devShell.aarch64-darwin', 'packages.aarch64-darwin.devShell.aarch64-darwin', 'legacyPackages.aarch64-darwin.devShell.aarch64-darwin', 'devShell.aarch64-darwin' or 'defaultPackage.aarch64-darwin'

I have no clue about the source of this error, any idea ?

What is the exact command you are running? For me this seems to work:

$ nix flake show
warning: creating lock file '/Users/nmelzer/tmp/flake.lock'
path:/Users/nmelzer/tmp?lastModified=1687350714&narHash=sha256-TuTn0aYovTgl0dmHIWUFgC7EqxI+6OWzt0MLNfoCLS8=
└───devShells
    ├───aarch64-darwin
    │   └───default: development environment 'nix-shell'
    ├───aarch64-linux
    │   └───default: development environment 'nix-shell'
    ├───x86_64-darwin
    │   └───default: development environment 'nix-shell'
    └───x86_64-linux
        └───default: development environment 'nix-shell'
$ nix develop
(nix:nix-shell-env) titan:tmp nmelzer$ pdflatex -version
pdfTeX 3.141592653-2.6-1.40.24 (TeX Live 2022/nixos.org)
kpathsea version 6.3.4
Copyright 2022 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.39; using libpng 1.6.39
Compiled with zlib 1.2.13; using zlib 1.2.13
Compiled with xpdf version 4.03
(nix:nix-shell-env) titan:tmp nmelzer$ exit
$ nix --version
nix (Nix) 2.13.3

Thank’s for your answer, I found that my nix installation may have been in a strange state. My nix version was too old and did not want to upgrade correctly. I just uninstalled everything and starts over from a clean installation. This time it works like a charm.