74 lines
1.6 KiB
Nix
74 lines
1.6 KiB
Nix
{ sources ? import ./npins, pkgs ? import sources.nixpkgs {} }:
|
|
{
|
|
packages = {
|
|
ofborg = pkgs.rustPlatform.buildRustPackage {
|
|
name = "ofborg";
|
|
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
pkg-config
|
|
rustPackages.clippy
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
|
|
darwin.apple_sdk.frameworks.Security
|
|
darwin.apple_sdk.frameworks.CoreFoundation
|
|
]);
|
|
|
|
preBuild = ''
|
|
cargo clippy
|
|
'';
|
|
|
|
doCheck = false; # Tests require access to a /nix/ and a nix daemon
|
|
checkInputs = with pkgs; [
|
|
lix
|
|
];
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
outputHashes = {
|
|
"hubcaps-0.6.2" = "sha256-yyHOCxUsehvtYfttRY4T9TDrJhSKGpJRa/SX3Sd1TNc=";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
shell = pkgs.mkShell {
|
|
name = "ofborg-devenv";
|
|
packages = with pkgs; [
|
|
lix
|
|
nix-prefetch-git
|
|
rustc
|
|
cargo
|
|
clippy
|
|
rustfmt
|
|
pkg-config
|
|
];
|
|
|
|
postHook = ''
|
|
checkPhase() (
|
|
cd "${builtins.toString ./.}/ofborg"
|
|
set -x
|
|
cargo fmt
|
|
git diff --exit-code
|
|
cargofmtexit=$?
|
|
|
|
cargo clippy
|
|
cargoclippyexit=$?
|
|
|
|
cargo build && cargo test
|
|
cargotestexit=$?
|
|
|
|
sum=$((cargofmtexit + cargoclippyexit + cargotestexit))
|
|
exit $sum
|
|
)
|
|
'';
|
|
|
|
RUSTFLAGS = "-D warnings";
|
|
RUST_BACKTRACE = "1";
|
|
RUST_LOG = "ofborg=debug";
|
|
NIX_PATH = "nixpkgs=${pkgs.path}";
|
|
};
|
|
}
|