2024-10-30 17:42:25 +00:00
|
|
|
{ sources ? import ./npins, pkgs ? import sources.nixpkgs {} }:
|
|
|
|
{
|
2024-11-14 18:04:07 +00:00
|
|
|
overlay = self: super:
|
|
|
|
let
|
|
|
|
inherit (super) lib;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
ofborg = super.rustPlatform.buildRustPackage {
|
|
|
|
name = "ofborg";
|
|
|
|
src = super.nix-gitignore.gitignoreSource [ ] ./.;
|
|
|
|
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
pkg-config
|
|
|
|
rustPackages.clippy
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals super.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 super; [
|
|
|
|
lix
|
|
|
|
];
|
|
|
|
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-10-30 17:42:25 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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 = "-";
|
2024-11-16 14:32:08 +00:00
|
|
|
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
|
2024-10-30 17:42:25 +00:00
|
|
|
packages = with pkgs; [
|
|
|
|
lix
|
|
|
|
gitFull
|
|
|
|
nix-prefetch-git
|
|
|
|
rustc
|
|
|
|
cargo
|
2024-11-16 15:47:28 +00:00
|
|
|
cargo-edit
|
|
|
|
cargo-outdated
|
2024-10-30 17:42:25 +00:00
|
|
|
clippy
|
|
|
|
rustfmt
|
|
|
|
pkg-config
|
|
|
|
rabbitmq-server
|
|
|
|
hivemind
|
2024-12-24 00:08:05 +00:00
|
|
|
diesel-cli
|
|
|
|
postgresql.dev
|
2024-10-30 17:42:25 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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}";
|
2024-12-24 00:08:05 +00:00
|
|
|
DATABASE_URL = "postgres:///ofborg";
|
2024-10-30 17:42:25 +00:00
|
|
|
};
|
|
|
|
}
|