{ 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"; RABBITMQ_CONFIG_FILE = pkgs.writeText "rabbitmq-dev.conf" '' listeners.tcp.1=:::5672 ''; TRIVIAL_PASSWORD = pkgs.writeText "trivial-password.txt" "test"; RABBITMQ_LOGS = "-"; packages = with pkgs; [ lix gitFull nix-prefetch-git rustc cargo clippy rustfmt pkg-config rabbitmq-server hivemind ]; 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 ) ''; shellHook = '' export RABBITMQ_MNESIA_BASE="$(git rev-parse --show-toplevel)/.rabbitmq-data"; export STATE_DIRECTORY="$(git rev-parse --show-toplevel)/.ofborg-state" mkdir -p "$STATE_DIRECTORY" mkdir -p "$RABBITMQ_MNESIA_BASE" ''; RUSTFLAGS = "-D warnings"; RUST_BACKTRACE = "1"; RUST_LOG = "ofborg=debug"; NIX_PATH = "nixpkgs=${pkgs.path}"; }; }