82 lines
1.9 KiB
Nix
82 lines
1.9 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
systems.url = "github:nix-systems/default";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
};
|
|
|
|
outputs =
|
|
inputs@{ flake-parts, ... }:
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
imports = [ ./shell.nix ];
|
|
|
|
perSystem =
|
|
{
|
|
self',
|
|
pkgs,
|
|
lib,
|
|
system,
|
|
...
|
|
}:
|
|
let
|
|
cargoToml = lib.importTOML ./Cargo.toml;
|
|
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = [
|
|
"rust-src"
|
|
"rustfmt"
|
|
"clippy"
|
|
];
|
|
};
|
|
in
|
|
{
|
|
_module.args = {
|
|
pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
inputs.rust-overlay.overlays.default
|
|
];
|
|
};
|
|
|
|
inherit rustToolchain;
|
|
};
|
|
|
|
formatter = pkgs.nixfmt-tree;
|
|
|
|
packages.default = pkgs.rustPlatform.buildRustPackage {
|
|
pname = cargoToml.package.name;
|
|
version = cargoToml.package.version;
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
openssl
|
|
];
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
};
|
|
|
|
checks = {
|
|
default = self'.packages.default;
|
|
|
|
format =
|
|
pkgs.runCommand "cargo-fmt"
|
|
{
|
|
nativeBuildInputs = [ rustToolchain ];
|
|
}
|
|
''
|
|
cd ${./.}
|
|
cargo fmt --all -- --check
|
|
touch $out
|
|
'';
|
|
};
|
|
};
|
|
|
|
systems = import inputs.systems;
|
|
};
|
|
}
|