How does flake-parts `withSystem` work?


how does flake-parts’s withSystem work?

The docs just say:

Enter the scope of a system. Example:

and give the snippet

{ withSystem, inputs, ... }:
  # perSystem = { ... }: { config.packages.hello = ...; }; = withSystem "x86_64-linux" (ctx@{ config, inputs', pkgs, ... }: {...}

Is it magic or is it some simple attribute set getter exposed in the form of lambda?

I can’t tell form the source code:


The passed in attributes are contextualized to the given system. Similar to how perSystems attributes are, with the difference, that you are in charge to choose the correct system and only that one system is used, rather than automatically for all defined systems.