From 86e202aff0210b376e2efc590242b6b0eb0c44e0 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Mon, 29 Apr 2024 21:44:06 +0100 Subject: [PATCH] flake: check package builds --- flake.nix | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index 3e538cd..f96a2e3 100644 --- a/flake.nix +++ b/flake.nix @@ -11,24 +11,27 @@ }; outputs = { self, nixpkgs, flake-utils, treefmt-nix, ... }@inputs: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.$${system}; + (flake-utils.lib.eachSystem + (with flake-utils.lib.system; [ x86_64-linux aarch64-darwin ]) + (system: { checks.builds = self.packages.$${system}.default; }) + // flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.$${system}; - cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); + cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); - treefmtEval = treefmt-nix.lib.evalModule pkgs (pkgs: { - projectRootFile = "flake.nix"; - programs.rustfmt.enable = true; - programs.nixfmt.enable = true; - }); - in { - packages.default = pkgs.rustPlatform.buildRustPackage { - inherit (cargoToml.package) name version; - src = ./.; - cargoLock.lockFile = ./Cargo.lock; - }; + treefmtEval = treefmt-nix.lib.evalModule pkgs (pkgs: { + projectRootFile = "flake.nix"; + programs.rustfmt.enable = true; + programs.nixfmt.enable = true; + }); + in { + packages.default = pkgs.rustPlatform.buildRustPackage { + inherit (cargoToml.package) name version; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + }; - formatter = treefmtEval.config.build.wrapper; - }); + formatter = treefmtEval.config.build.wrapper; + })); }