For some reasons, you might want to limit the target systems of your flake. Most templates use lib.systems.flakeExposed
from nixpkgs to specify the target systems, but your Nix packages may not be supported on some of the systems. It would be possible to explicitly list the target systems in your flake, but that can be a restriction to its consumers.
With nix-systems, you can specify the default target systems, while allowing users to override the setting at their discretion.
To use nix-systems, follow these steps:
Add
systems
input to your flake.nix:inputs = {...+ systems.url = "github:nix-systems/default";};Make
systems
input visible in theoutputs
scope in the flake.nix:outputs = { nixpkgs, ... }:outputs = { nixpkgs, systems, ... }:Replace
nixpkgs.lib.systems.flakeExposed
with(import systems)
:eachSystem =f:nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: f nixpkgs.legacyPackages.${system});nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});