2023-08-26 03:37:24 -04:00
|
|
|
{
|
|
|
|
inputs = {
|
2023-08-26 17:44:04 -04:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2023-08-26 03:37:24 -04:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-08-26 17:44:04 -04:00
|
|
|
|
2023-08-27 04:30:45 -04:00
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
rust-overlay.inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
flake-utils.follows = "flake-utils";
|
|
|
|
};
|
|
|
|
|
2023-08-26 17:44:04 -04:00
|
|
|
crane.url = "github:ipetkov/crane";
|
|
|
|
crane.inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
flake-utils.follows = "flake-utils";
|
2023-08-27 04:30:45 -04:00
|
|
|
rust-overlay.follows = "rust-overlay";
|
2023-08-26 17:44:04 -04:00
|
|
|
};
|
2023-08-26 03:37:24 -04:00
|
|
|
};
|
|
|
|
|
2023-08-27 04:30:45 -04:00
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay, crane, ... }:
|
2023-08-26 03:37:24 -04:00
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
2023-08-27 04:30:45 -04:00
|
|
|
let pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [ rust-overlay.overlays.default ];
|
|
|
|
};
|
|
|
|
rustToolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
|
|
|
|
craneLib = crane.lib.${system}.overrideToolchain rustToolchain;
|
2023-08-26 16:46:22 -04:00
|
|
|
|
2023-08-27 01:46:20 -04:00
|
|
|
commonArgs = {
|
2023-10-03 23:37:51 -04:00
|
|
|
pname = "startrnr";
|
2023-10-14 00:45:07 -04:00
|
|
|
version = "0.2.0";
|
2023-08-27 01:46:20 -04:00
|
|
|
src = craneLib.path ./.;
|
2023-08-27 05:05:22 -04:00
|
|
|
buildInputs = [ pkgs.openssl pkgs.sqlite ];
|
2023-08-27 01:46:20 -04:00
|
|
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
2023-10-05 01:47:09 -04:00
|
|
|
doCheck = false;
|
2023-08-27 01:46:20 -04:00
|
|
|
};
|
2023-08-26 17:44:04 -04:00
|
|
|
|
2023-08-27 01:46:20 -04:00
|
|
|
# Cargo build dependencies/artifacts only
|
|
|
|
# This derivation exists so that multiple builds can reuse
|
|
|
|
# the same build artifacts
|
2023-08-27 05:25:45 -04:00
|
|
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
2023-08-27 01:46:20 -04:00
|
|
|
|
|
|
|
# Run clippy (and deny all warnings) on the crate source
|
|
|
|
runClippy = craneLib.cargoClippy (commonArgs // {
|
|
|
|
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
|
|
|
inherit cargoArtifacts;
|
|
|
|
});
|
|
|
|
|
2023-10-03 23:37:51 -04:00
|
|
|
startrnr = craneLib.buildPackage (commonArgs // {
|
2023-08-27 01:46:20 -04:00
|
|
|
inherit cargoArtifacts;
|
|
|
|
});
|
|
|
|
in {
|
2023-10-03 23:37:51 -04:00
|
|
|
packages.startrnr = startrnr;
|
|
|
|
packages.default = startrnr;
|
2023-08-26 03:37:24 -04:00
|
|
|
|
2023-10-05 01:47:09 -04:00
|
|
|
checks.build = startrnr.overrideAttrs {
|
|
|
|
doCheck = true;
|
|
|
|
cargoArtifacts = cargoArtifacts.overrideAttrs { doCheck = true; };
|
|
|
|
};
|
2023-08-27 01:46:20 -04:00
|
|
|
checks.runClippy = runClippy;
|
2023-08-26 03:37:24 -04:00
|
|
|
|
|
|
|
devShells.default = pkgs.mkShell {
|
2023-08-27 04:30:45 -04:00
|
|
|
packages = with pkgs; [ rustToolchain pkg-config rust-analyzer ];
|
2023-08-26 16:46:22 -04:00
|
|
|
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
2023-08-26 03:37:24 -04:00
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|