58 lines
1.7 KiB
Nix
58 lines
1.7 KiB
Nix
|
{
|
||
|
description = "FILL-ME-IN";
|
||
|
|
||
|
inputs = {
|
||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||
|
crane.url = "github:ipetkov/crane";
|
||
|
crane.inputs.nixpkgs.follows = "nixpkgs";
|
||
|
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
|
||
|
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
|
||
|
};
|
||
|
|
||
|
outputs = { self, flake-parts, crane, pre-commit, ... }:
|
||
|
flake-parts.lib.mkFlake { inherit self; } {
|
||
|
imports = [ pre-commit.flakeModule ];
|
||
|
systems = [
|
||
|
"aarch64-darwin"
|
||
|
"x86_64-darwin"
|
||
|
"aarch64-linux"
|
||
|
"x86_64-linux"
|
||
|
];
|
||
|
perSystem = { config, pkgs, system, ... }:
|
||
|
let
|
||
|
crane-lib = crane.lib.${system};
|
||
|
package = crane-lib.buildPackage {
|
||
|
src = crane-lib.cleanCargoSource ./.;
|
||
|
nativeBuildInputs = [ pkgs.libiconv ];
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
pre-commit.settings.hooks = {
|
||
|
rustfmt.enable = true;
|
||
|
clippy.enable = true;
|
||
|
cargo-check.enable = true;
|
||
|
};
|
||
|
checks = { inherit package; };
|
||
|
packages.default = package;
|
||
|
devShells.default = pkgs.mkShell {
|
||
|
shellHook = ''
|
||
|
${config.pre-commit.installationScript}
|
||
|
echo "welcome to your rust project ミ(・・)ミ" 1>&2
|
||
|
'';
|
||
|
inputsFrom = builtins.attrValues self.checks;
|
||
|
|
||
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||
|
nativeBuildInputs = with pkgs; [
|
||
|
cargo
|
||
|
rustc
|
||
|
];
|
||
|
buildInputs = with pkgs; [
|
||
|
rustfmt
|
||
|
clippy
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|