monorepo/glimmer/rust/flake.nix

58 lines
1.4 KiB
Nix

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