flake: merge eachSystem{,Pkgs} into a single function

This commit is contained in:
poz 2026-05-20 21:45:02 +02:00
commit 29f2a1d757
No known key found for this signature in database

View file

@ -8,13 +8,11 @@
systems = nixpkgs.lib.systems.flakeExposed; systems = nixpkgs.lib.systems.flakeExposed;
# Provide simple per-system abstraction # Provide simple per-system abstraction
# either giving you the system directly # giving you the system and
# or the package set for that system. # the package set for that system directly.
eachSystem = nixpkgs.lib.genAttrs systems; eachSystem = f:
eachSystemPkgs = f:
nixpkgs.lib.genAttrs systems nixpkgs.lib.genAttrs systems
(system: f nixpkgs.legacyPackages.${system}); (system: f system nixpkgs.legacyPackages.${system});
# Call the extended library with `inputs`. # Call the extended library with `inputs`.
# inputs is used to get the original standard library, and to pass inputs # inputs is used to get the original standard library, and to pass inputs
@ -59,8 +57,8 @@
# entire Nix source with Alejandra. The wrapper script is necessary due to # entire Nix source with Alejandra. The wrapper script is necessary due to
# changes to the behaviour of Nix, which now encourages wrappers for # changes to the behaviour of Nix, which now encourages wrappers for
# tree-wide formatting. # tree-wide formatting.
formatter = eachSystemPkgs ( formatter = eachSystem (
pkgs: _: pkgs:
pkgs.writeShellApplication { pkgs.writeShellApplication {
name = "nix3-fmt-wrapper"; name = "nix3-fmt-wrapper";
@ -84,7 +82,7 @@
# Provides checks to be built an ran on 'nix flake check'. They can also # Provides checks to be built an ran on 'nix flake check'. They can also
# be built individually with 'nix build' as described below. # be built individually with 'nix build' as described below.
checks = eachSystemPkgs (pkgs: { checks = eachSystem (_: pkgs: {
# Check if codebase is properly formatted. # Check if codebase is properly formatted.
# This can be initiated with `nix build .#checks.<system>.nix-fmt` # This can be initiated with `nix build .#checks.<system>.nix-fmt`
# or with `nix flake check` # or with `nix flake check`
@ -115,7 +113,7 @@
templates = import ./flake/templates; templates = import ./flake/templates;
apps = eachSystem (system: let apps = eachSystem (system: _: let
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
in { in {
nix = { nix = {
@ -135,8 +133,8 @@
inherit (lib.attrsets) recursiveUpdate; inherit (lib.attrsets) recursiveUpdate;
in in
recursiveUpdate recursiveUpdate
(eachSystem (system: import ./flake/packages.nix {inherit inputs lib self system;})) (eachSystem (system: _: import ./flake/packages.nix {inherit inputs lib self system;}))
(eachSystemPkgs (pkgs: { (eachSystem (_: pkgs: {
# This package exists to make development easier by providing the place and # This package exists to make development easier by providing the place and
# boilerplate to build a test nvf configuration. Feel free to use this for # boilerplate to build a test nvf configuration. Feel free to use this for
# testing, but make sure to discard the changes before creating a pull # testing, but make sure to discard the changes before creating a pull
@ -156,7 +154,7 @@
customNeovim.neovim; customNeovim.neovim;
})); }));
devShells = eachSystemPkgs (pkgs: { devShells = eachSystem (_: pkgs: {
# The default dev shell provides packages required to interact with # The default dev shell provides packages required to interact with
# the codebase as described by the contributing guidelines. It includes the # the codebase as described by the contributing guidelines. It includes the
# formatters required, and a few additional goodies for linting work. # formatters required, and a few additional goodies for linting work.