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:
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;
}));
}