When creating flakes, which system should be used in packages.<system>.<name>?

The documentation for nix flake check says:

The following flake output attributes must be derivations:

  • checks.system.name
  • devShells.system.default
  • devShells.system.name
  • nixosConfigurations.name.config.system.build.toplevel
  • packages.system.default
  • packages.system.name

From what I understand, derivations have only one system normally and have multiple systems when the derivation’s outputs are cross-compiled. Here’s a list of all of the places (that I know of) where a system is specified:

When creating flakes, which of those systems should I use for packages.<system>.<name>?

Flakes don’t really understand cross-compilation. So the assumption is target = host = build platform. Just use whatever you get from builtins.currentSystem if you only want to support your current system, or you can use lib.systems.flakeExposed to support everything nixpkgs does. Or anything in between.

If you do want to support cross-compilation with your flake outputs, you’d best provide an overlay and final.callPackage your nix expression (which ends up being, generally, system-independent anyway).