-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
25 lines (25 loc) · 924 Bytes
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ mkShell, stdenv, lib }:
{ buildInputs, shellHook ? "" }:
let
environment = stdenv.mkDerivation {
name = "environment";
phases = [ "installPhase" "fixupPhase" ];
installPhase = "touch $out";
buildInputs = buildInputs;
};
in mkShell {
buildInputs = environment.drvAttrs.buildInputs;
shellHook = let
# We use the store-path for environment as our Bundler cache-key to rebuild gems when the environment changes
environmentId = lib.last (lib.strings.splitString "/" "${environment}");
in ''
if [ -z "$BUNDLE_PATH" ]; then
export BUNDLE_PATH=.bundle/${environmentId}
elif [ "$BUNDLE_PATH" != ".bundle/${environmentId}" ]; then
export BUNDLE_PATH=$BUNDLE_PATH/${environmentId}
fi
'' + lib.optionalString stdenv.isLinux ''
# Make sure we have a 'big' enough locale for Heroku output on CI
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
'' + shellHook;
}