{ description = "arc – a delta-based version control system"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; crane = { url = "github:ipetkov/crane"; }; }; outputs = inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; perSystem = { system, pkgs, ... }: let rustToolchain = inputs.fenix.packages.${system}.stable.withComponents [ "rustc" "cargo" "clippy" "rustfmt" "rust-src" ]; craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain; src = craneLib.cleanCargoSource ./.; commonArgs = { pname = "arc"; version = "0.1.0"; inherit src; strictDeps = true; nativeBuildInputs = [ pkgs.pkg-config pkgs.cmake pkgs.perl ]; nativeCheckInputs = [ pkgs.git pkgs.openssh ]; }; cargoArtifacts = craneLib.buildDepsOnly commonArgs; arc = craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; }); in { packages = { inherit arc; default = arc; }; apps.default = { type = "app"; program = "${arc}/bin/arc"; }; checks = { inherit arc; clippy = craneLib.cargoClippy (commonArgs // { inherit cargoArtifacts; cargoClippyExtraArgs = "--all-targets -- --deny warnings"; }); fmt = craneLib.cargoFmt { inherit src; }; test = craneLib.cargoTest (commonArgs // { inherit cargoArtifacts; }); }; devShells.default = pkgs.mkShell { packages = [ rustToolchain pkgs.git pkgs.pkg-config pkgs.cmake pkgs.perl ]; RUST_BACKTRACE = "1"; }; }; }; }