# Flake `system`
Oldest flake user issues
- #3487 Custom flake checkers
- flake-parts?
- #3602 follows behavior for flakes used as inputs
- Unsolved, 9 comments
- #3733 Confusing default update lock file behavoir
- Appears solved
- #3811 flake: command to build all the derivations
- Solved with flake check
- **#3843 provide builtins.currentSystem as a input to flakes**
- Unsolved, 48 comments
- **Better solution possible**
We can't have such a protracted experimental stage and not improve the flake schema despite the issues.
## Basic Solution
- Solution for unusable rare `system` values
- Incidentally, make `flake-utils` `forAllSystems` redundant
- No semantic compromise
- Close to the current schema
### Schema
- Add `systems :: ListOf String` (or `AttrsOf {}`)
- Add `perSystem :: ({ system :: String } -> Any) -> FlakeAttrs'`
- `FlakeAttrs`:
- `packages.<name>`
- `checks.<name>`
- ...
but not `overlays`, `nixosConfigurations`, etc
### `call-flake.nix`
- Improve the flake attributes
- Generate `packages.<system>` etc using `systems` and `perSystem` if both are defined
- Generate `perSystem` if any of `packages` etc is defined, but not `perSystem`
- Wrap `perSystem` to memoize it, at least for the keys in `systems`
## Convenient Solution
- `perSystem :: FlakeInputs' -> FlakeAttrs'`
- `FlakeInputs'`:
- For each input `${name} = flake.perSystem system`
- `self = top.self // perSystem system` where `top` is the top level flake output arguments (aka inputs)
- `system`
# FIXME
- System is more complicated than a string
# Refs
- https://github.com/NixOS/nix/issues/3843#issuecomment-1150111304