forked from the-distro/ofborg
986be3ceb7
By switching to the tools bundled within nixpkgs we can provide a much more "pure" development environment that doesn't randomly change over time. Previously we would be using the latest and greatest version of the formatting and linting tools while our development environment only offered whatever was in the (old) nixpkgs pin. Nowadays we have all the tools we need in nixpkgs and can thus use those instead. By following nixpkgs more closely we can make sure to make use of those tools in this project as well. Hopefully removing the "yearly churn" of doing big migrations. For the meantime I allowed the upper case acronyms check (and a few other minor lints) in the clippy configuration. This will allow a smoother transition towards the newer clippy code that is decoupled from the actual linting changes.
72 lines
1.4 KiB
Nix
72 lines
1.4 KiB
Nix
{ pkgs ? import ./nix {
|
|
overlays = [
|
|
(import ./nix/overlay.nix)
|
|
];
|
|
} }:
|
|
|
|
let
|
|
inherit (pkgs) stdenv lib;
|
|
|
|
phpEnv = stdenv.mkDerivation rec {
|
|
name = "gh-event-forwarder";
|
|
src = null;
|
|
buildInputs = with pkgs; [
|
|
nix-prefetch-git
|
|
php
|
|
phpPackages.composer
|
|
git
|
|
php
|
|
curl
|
|
bash
|
|
];
|
|
|
|
# HISTFILE = "${src}/.bash_hist";
|
|
};
|
|
|
|
rustEnv = stdenv.mkDerivation {
|
|
name = "gh-event-forwarder";
|
|
nativeBuildInputs = with pkgs; [
|
|
nix # so in --pure mode we actually find the "correct" nix
|
|
bash
|
|
nix-prefetch-git
|
|
rustPackages.cargo
|
|
rustPackages.clippy
|
|
rustPackages.rustfmt
|
|
pkg-config
|
|
git
|
|
];
|
|
buildInputs = with pkgs; [
|
|
openssl
|
|
]
|
|
++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
|
|
|
|
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
|
|
)
|
|
'';
|
|
|
|
HISTFILE = "${toString ./.}/.bash_hist";
|
|
RUSTFLAGS = "-D warnings";
|
|
RUST_BACKTRACE = "1";
|
|
RUST_LOG = "ofborg=debug";
|
|
NIX_PATH = "nixpkgs=${pkgs.path}";
|
|
passthru.phpEnv = phpEnv;
|
|
};
|
|
|
|
in rustEnv
|