From ab84656f19fe2bd7053d54d6eee60aa3efa8898b Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 4 Jul 2024 16:00:23 -0400 Subject: nix: simplify forAllSystems --- flake.nix | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index a10ed5b..5351034 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,7 @@ flake-checks, }: let + inherit (nixpkgs) lib; systems = [ "x86_64-linux" "aarch64-linux" @@ -20,15 +21,16 @@ "aarch64-darwin" ]; - forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system}); + forAllSystems = lib.genAttrs systems; + nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); in { checks = forAllSystems ( - pkgs: + system: let flake-checks' = flake-checks.lib.mkChecks { root = ./.; - inherit pkgs; + pkgs = nixpkgsFor.${system}; }; in { @@ -41,22 +43,23 @@ } ); - devShells = forAllSystems ( - { pkgs, system, ... }: - { - default = import ./shell.nix { - inherit pkgs system; - formatter = self.formatter.${system}; - }; - } - ); + devShells = forAllSystems (system: { + default = import ./shell.nix { + inherit system; + pkgs = nixpkgsFor.${system}; + formatter = self.formatter.${system}; + }; + }); - formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); + formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style); packages = forAllSystems ( - { pkgs, system, ... }: + system: let - pkgs' = import ./. { inherit pkgs system; }; + pkgs' = import ./. { + inherit system; + pkgs = nixpkgsFor.${system}; + }; in pkgs' // { default = pkgs'.website; } ); -- cgit v1.2.3