From 87974028d1692710244f866a35db8d628aad66c9 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 2 Jan 2019 20:06:50 -0500 Subject: [PATCH] build phase for rust pedantry --- .travis.yml | 6 ++++-- shell.nix | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 185cb31..f2c6bb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,11 @@ nix: 2.1 sudo: true matrix: include: + - name: checkPhase - Nix 2 + script: nix-shell --run checkPhase --arg useNix1 false - name: checkPhase - Nix 2 script: nix-shell --run checkPhase --arg useNix1 false - name: checkPhase - Nix 1 script: nix-shell --run checkPhase --arg useNix1 true - - name: nix-build - script: nix-build -A ofborg.rs + - name: cargo pedantry + script: nix-shell --run pedantryPhase --arg useNix1 false -A mozilla-rust-overlay diff --git a/shell.nix b/shell.nix index 7037736..5322088 100644 --- a/shell.nix +++ b/shell.nix @@ -35,6 +35,40 @@ let # HISTFILE = "${src}/.bash_hist"; }; + mozilla-rust-overlay = stdenv.mkDerivation (rec { + name = "gh-event-forwarder"; + buildInputs = with pkgs; [ + bash + nix-prefetch-git + rust.rustc + rust.cargo + #rustfmt + #carnix + openssl.dev + pkgconfig + git + ] + ++ stdenv.lib.optional useNix1 oldpkgs.nix1 + ++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security; + + postHook = '' + checkPhase() { + ( cd "${builtins.toString ./.}/ofborg" && cargo build && cargo test) + } + ''; + + HISTFILE = "${toString ./.}/.bash_hist"; + RUSTFLAGS = "-D warnings"; + RUST_BACKTRACE = "1"; + RUST_LOG = "ofborg=debug"; + NIX_PATH = "nixpkgs=${pkgs.path}"; + passthru.phpEnv = phpEnv; + } + // stdenv.lib.optionalAttrs stdenv.isLinux { + LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive"; + LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive"; + }); + rustEnv = stdenv.mkDerivation (rec { name = "gh-event-forwarder"; buildInputs = with pkgs; [