2022-11-30 01:41:05 +00:00
|
|
|
{
|
|
|
|
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";
|
2022-11-30 03:19:54 +00:00
|
|
|
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
|
2022-11-30 01:41:05 +00:00
|
|
|
};
|
|
|
|
|
2024-07-18 14:16:04 +00:00
|
|
|
outputs =
|
|
|
|
inputs@{
|
|
|
|
self,
|
|
|
|
flake-parts,
|
|
|
|
crane,
|
|
|
|
pre-commit,
|
|
|
|
...
|
|
|
|
}:
|
2023-01-04 00:37:19 +00:00
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
2022-11-30 03:19:54 +00:00
|
|
|
imports = [ pre-commit.flakeModule ];
|
2024-07-18 14:16:04 +00:00
|
|
|
systems = [
|
|
|
|
"aarch64-darwin"
|
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
|
|
|
perSystem =
|
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
system,
|
|
|
|
...
|
|
|
|
}:
|
2022-11-30 01:41:05 +00:00
|
|
|
let
|
2022-11-30 03:19:54 +00:00
|
|
|
crane-lib = crane.lib.${system};
|
2022-11-30 01:41:05 +00:00
|
|
|
package = crane-lib.buildPackage {
|
|
|
|
src = crane-lib.cleanCargoSource ./.;
|
2024-07-18 14:16:04 +00:00
|
|
|
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
|
2022-11-30 01:41:05 +00:00
|
|
|
};
|
2024-07-18 14:16:04 +00:00
|
|
|
in
|
|
|
|
{
|
2022-11-30 03:19:54 +00:00
|
|
|
pre-commit.settings.hooks = {
|
|
|
|
rustfmt.enable = true;
|
|
|
|
clippy.enable = true;
|
|
|
|
cargo-check.enable = true;
|
2022-11-30 01:41:05 +00:00
|
|
|
};
|
2024-07-18 14:16:04 +00:00
|
|
|
checks = {
|
|
|
|
inherit package;
|
|
|
|
};
|
2022-11-30 01:41:05 +00:00
|
|
|
packages.default = package;
|
|
|
|
devShells.default = pkgs.mkShell {
|
2022-11-30 03:19:54 +00:00
|
|
|
shellHook = ''
|
|
|
|
${config.pre-commit.installationScript}
|
|
|
|
echo "welcome to your rust project ミ(・・)ミ" 1>&2
|
|
|
|
'';
|
2022-11-30 01:41:05 +00:00
|
|
|
inputsFrom = builtins.attrValues self.checks;
|
|
|
|
|
2024-07-18 14:16:04 +00:00
|
|
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
|
|
|
nativeBuildInputs = builtins.attrValues { inherit (pkgs) cargo rustc; };
|
|
|
|
buildInputs = builtins.attrValues { inherit (pkgs) rust-analyzer rustfmt clippy; };
|
2022-11-30 01:41:05 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|