lyrs/flake.nix

55 lines
1.3 KiB
Nix
Raw Normal View History

2023-11-10 20:06:30 -06:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {self, ...}:
inputs.utils.lib.eachDefaultSystem (system: let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
(import inputs.rust-overlay)
];
};
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
naersk = pkgs.callPackage inputs.naersk {
cargo = toolchain;
rustc = toolchain;
};
in {
packages.default = naersk.buildPackage {
src = ./.;
};
formatter = pkgs.alejandra;
checks = {
inherit (self.packages.${system}) default;
# TODO: clippy and other checks?
};
devShell = with pkgs;
mkShell {
buildInputs = [
hurl
toolchain
rustfmt
rustPackages.clippy
rust-analyzer
];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
});
}