buscemi/flake.nix

67 lines
2.1 KiB
Nix
Raw Normal View History

2023-02-28 04:30:14 +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";
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, flake-parts, crane, pre-commit, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ pre-commit.flakeModule ];
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
perSystem = { config, pkgs, system, ... }:
let
crane-lib = crane.lib.${system};
package = crane-lib.buildPackage {
src = crane-lib.cleanCargoSource ./.;
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ 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}";
2023-02-28 22:50:56 +00:00
nativeBuildInputs = builtins.attrValues ({
2023-02-28 04:30:14 +00:00
inherit (pkgs)
cargo
2023-02-28 22:50:56 +00:00
cargo-watch
2023-02-28 04:30:14 +00:00
rustc
;
2023-02-28 22:50:56 +00:00
} // pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
inherit (pkgs) libiconv;
inherit (pkgs.darwin.apple_sdk.frameworks) Security;
});
2023-02-28 04:30:14 +00:00
buildInputs = builtins.attrValues {
inherit (pkgs)
rust-analyzer
rustfmt
clippy
;
};
};
};
};
}