1
0
Fork 0
mirror of https://github.com/NixOS/ofborg synced 2024-10-18 14:56:36 -04:00
ofborg/shell.nix

108 lines
2.5 KiB
Nix
Raw Normal View History

{ pkgs ? import ./nix {
overlays = [
(import ./nix/overlay.nix)
(import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz))
];
} }:
2017-10-29 17:10:26 -04:00
2018-04-04 17:13:56 -04:00
let
2018-09-03 17:14:17 -04:00
# A random Nixpkgs revision *before* the default glibc
# was switched to version 2.27.x.
oldpkgsSrc = pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "0252e6ca31c98182e841df494e6c9c4fb022c676";
sha256 = "1sr5a11sb26rgs1hmlwv5bxynw2pl5w4h5ic0qv3p2ppcpmxwykz";
};
oldpkgs = import oldpkgsSrc {};
2021-04-01 15:31:05 -04:00
inherit (pkgs) stdenv lib;
2017-10-29 17:10:26 -04:00
2017-11-05 09:46:42 -05:00
phpEnv = stdenv.mkDerivation rec {
name = "gh-event-forwarder";
src = null;
2017-11-05 09:46:42 -05:00
buildInputs = with pkgs; [
2017-11-29 22:31:40 -05:00
nix-prefetch-git
2017-11-05 09:46:42 -05:00
php
phpPackages.composer
git
php
curl
bash
];
2017-11-05 09:46:42 -05:00
2017-11-29 22:31:40 -05:00
# HISTFILE = "${src}/.bash_hist";
2017-11-05 09:46:42 -05:00
};
2019-01-02 20:06:50 -05:00
mozilla-rust-overlay = stdenv.mkDerivation (rec {
2019-01-02 20:18:42 -05:00
name = "mozilla-rust-overlay";
2019-01-02 20:06:50 -05:00
buildInputs = with pkgs; [
2019-01-02 20:18:42 -05:00
latest.rustChannels.stable.rust
2019-01-02 20:06:50 -05:00
git
2021-03-17 04:22:27 -04:00
pkg-config
openssl
2019-01-02 20:06:50 -05:00
]
2021-04-01 15:31:05 -04:00
++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
2019-01-02 20:06:50 -05:00
postHook = ''
2019-01-02 20:18:42 -05:00
checkPhase() (
cd "${builtins.toString ./.}/ofborg"
2019-01-02 21:28:11 -05:00
set -x
2019-01-02 20:18:42 -05:00
cargo fmt
git diff --exit-code
cargofmtexit=$?
cargo clippy
cargoclippyexit=$?
sum=$((cargofmtexit + cargoclippyexit))
exit $sum
)
2019-01-02 20:06:50 -05:00
'';
RUSTFLAGS = "-D warnings";
RUST_BACKTRACE = "1";
NIX_PATH = "nixpkgs=${pkgs.path}";
}
2021-04-01 15:31:05 -04:00
// lib.optionalAttrs stdenv.isLinux {
2019-01-02 20:06:50 -05:00
LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive";
LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
});
rustEnv = stdenv.mkDerivation (rec {
2017-11-05 09:46:42 -05:00
name = "gh-event-forwarder";
buildInputs = with pkgs; [
2018-09-03 17:14:17 -04:00
bash
2017-11-29 22:31:40 -05:00
nix-prefetch-git
2019-03-21 18:13:36 -04:00
latest.rustChannels.stable.rust
#rustfmt
openssl
2021-03-17 04:22:27 -04:00
pkg-config
git
2018-04-04 17:13:56 -04:00
]
2021-04-01 15:31:05 -04:00
++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
2017-11-05 09:46:42 -05:00
postHook = ''
checkPhase() {
2018-12-01 08:50:54 -05:00
( cd "${builtins.toString ./.}/ofborg" && cargo build && cargo test)
}
'';
HISTFILE = "${toString ./.}/.bash_hist";
RUSTFLAGS = "-D warnings";
2018-09-06 21:35:32 -04:00
RUST_BACKTRACE = "1";
RUST_LOG = "ofborg=debug";
NIX_PATH = "nixpkgs=${pkgs.path}";
2017-12-04 20:55:44 -05:00
passthru.phpEnv = phpEnv;
2019-01-02 20:18:42 -05:00
passthru.mozilla-rust-overlay = mozilla-rust-overlay;
}
2021-04-01 15:31:05 -04:00
// lib.optionalAttrs stdenv.isLinux {
LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive";
LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
});
2017-11-05 09:46:42 -05:00
2017-12-04 20:55:44 -05:00
in rustEnv