monorepo/glimmer/rust/flake.nix

58 lines
1.4 KiB
Nix
Raw Normal View History

2023-03-16 21:48:20 +00:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2023-03-17 00:47:02 +00:00
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
2023-03-16 21:48:20 +00:00
flake-utils.url = "github:numtide/flake-utils";
};
2023-03-17 00:47:02 +00:00
outputs = { self, nixpkgs, crane, flake-utils, ... }:
2023-03-16 21:48:20 +00:00
flake-utils.lib.eachDefaultSystem (system:
let
2023-03-17 00:47:02 +00:00
pkgs = import nixpkgs { inherit system; };
2023-03-16 21:48:20 +00:00
craneLib = crane.lib.${system};
2023-03-17 00:47:02 +00:00
src = ./.;
2023-03-16 21:48:20 +00:00
2023-03-17 00:47:02 +00:00
cargoArtifacts = craneLib.buildDepsOnly {
name = "glimmer-deps";
inherit src;
nativeBuildInputs = [
pkgs.pkg-config
pkgs.glib
pkgs.gtk4
2023-03-16 21:48:20 +00:00
];
};
2023-03-17 00:47:02 +00:00
glimmer-clippy = craneLib.cargoClippy {
name = "glimmer-clippy";
inherit cargoArtifacts src;
cargoClippyExtraArgs = "-- --deny warnings";
2023-03-16 21:48:20 +00:00
};
2023-03-17 00:47:02 +00:00
glimmer = craneLib.buildPackage {
name = "glimmer";
inherit cargoArtifacts src;
2023-03-16 21:48:20 +00:00
2023-03-17 00:47:02 +00:00
nativeBuildInputs = [
pkgs.pkg-config
pkgs.glib
pkgs.gtk4
];
2023-03-16 21:48:20 +00:00
};
2023-03-17 00:47:02 +00:00
in
{
packages.default = glimmer;
2023-03-16 21:48:20 +00:00
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks.${system};
nativeBuildInputs = with pkgs; [
cargo
rustc
];
};
2023-03-17 00:47:02 +00:00
checks = {
inherit glimmer glimmer-clippy;
};
2023-03-16 21:48:20 +00:00
});
}