Flake git+https protocol inconsistency

The command

nix run git+https://codeberg.org/jacg/rust-darwin-flake#hdf

gives inconsistent results.

When successful, it prints

Managed to write and read an HDF5 table.

on standard out.

  • On (a particular machine using) apple silicon running Big Sur, it fails with

    error: cannot find flake attribute 'git+https://codeberg.org/jacg/rust-darwin-flake#hdf'
    

    but it succeeds on apple silicon running Monterey. I’m not saying that the difference between OSes is responsible, but I’ve tried to eliminate all other differences, such as Nix versions. The machine where it fails, was originally running Nix 2.4, but that was wiped completely and replaced with Nix 2.6, to match the two Monterey M1s on which I tried it.

    edit: This machine has no problem running flakes via the github protocol.

    edit 2: This appears to have been caused by Rosetta implicitly picking x86_64-darwin while the flake only supported x86_64-linux and aarch64-darwin. Adding x86_64-darwin to the flake makes this problem go away.

  • On non-NixOS Linux running nix 2.4, it errors with

    error: store path '/nix/store/djgknz8041ckabqfsz335vwlgx4n0jap-nixified-rust-project-crate2nix' is not allowed to have references
    

    The crate2nix - not allowed to have references combination seems to be a bug in nixpkgs-21.11 that has been torturing me quite a bit recently. I am not aware of any workaround besides using nixpkgs-unstable. I do not have admin rights on this machine, but I would hope that using nixpkgs-unstable in the flake itself would suffice.

    edit: This machine, too, has no problem running flakes via the github protocol.

Can you give any insight into what might be going on here?

The Darwin problem might be explained by Rosetta:

  • The flake only supports x86_64-linux and aarch64-darwin.
  • The problematic machine seems to use x86_64-darwin implicitly, in the terminals in which the trials were made. (The machine belongs to someone else, remote, who won’t be available over the weekend.)

Yes, the problem on MacOS appears to have been caused by Rosetta implicitly picking x86_64-darwin while the flake only supported x86_64-linux and aarch64-darwin . Adding x86_64-darwin to the flake, makes this problem go away on that machine.

I am not a MacOS user. Can you suggest a decent spelling of “What system (OS/architecture combination) will be used if I evaluate a Nix expression in this terminal?” on MacOS ?