flake: check package builds

This commit is contained in:
Jake Hillion 2024-04-29 21:44:06 +01:00
parent 3c6091106f
commit 86e202aff0

View File

@ -11,24 +11,27 @@
}; };
outputs = { self, nixpkgs, flake-utils, treefmt-nix, ... }@inputs: outputs = { self, nixpkgs, flake-utils, treefmt-nix, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system: (flake-utils.lib.eachSystem
let (with flake-utils.lib.system; [ x86_64-linux aarch64-darwin ])
pkgs = nixpkgs.legacyPackages.$${system}; (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: { treefmtEval = treefmt-nix.lib.evalModule pkgs (pkgs: {
projectRootFile = "flake.nix"; projectRootFile = "flake.nix";
programs.rustfmt.enable = true; programs.rustfmt.enable = true;
programs.nixfmt.enable = true; programs.nixfmt.enable = true;
}); });
in { in {
packages.default = pkgs.rustPlatform.buildRustPackage { packages.default = pkgs.rustPlatform.buildRustPackage {
inherit (cargoToml.package) name version; inherit (cargoToml.package) name version;
src = ./.; src = ./.;
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
}; };
formatter = treefmtEval.config.build.wrapper; formatter = treefmtEval.config.build.wrapper;
}); }));
} }