-
-
Save pcarrier/249f7e2e54770188f22316e6a08a2d89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> { } } : | |
let tools = with pkgs; [ | |
bash | |
curl | |
direnv | |
docker | |
gcc | |
gitAndTools.gitFull | |
gitAndTools.hub | |
openssh | |
python | |
gnutar | |
unzip | |
which | |
]; | |
envScripts = builtins.filterSource | |
(path: type: pkgs.lib.hasSuffix ".sh" path) | |
./tools/env; | |
mkEnvPackage = name: | |
let | |
scriptPath = ./tools/env + "/${name}"; | |
in | |
pkgs.stdenv.mkDerivation { | |
name = "monorepo-env-${name}"; | |
buildInputs = tools; | |
phases = [ "installPhase" ]; | |
installPhase = '' | |
echo "===== BEGIN ${name} =====" | |
echo "PATH: $PATH" | |
MONOREPO_INSTALL_DIR=$out ${scriptPath} | |
echo "===== END ${name} =====" | |
''; | |
}; | |
envNames = builtins.attrNames (builtins.readDir envScripts); | |
envPkgs = map mkEnvPackage envNames; | |
in | |
pkgs.buildEnv { | |
name = "monorepo-env"; | |
paths = envPkgs ++ tools; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
case "$(uname)" in | |
Darwin*) OS=darwin;; | |
Linux*) OS=linux;; | |
esac | |
VERSION=0.3.2 | |
DEST="${MONOREPO_INSTALL_DIR}/dep/${VERSION}-${OS}" | |
FILEPATH="${DEST}/dep" | |
URL="https://github.com/golang/dep/releases/download/v${VERSION}/dep-${OS}-amd64" | |
if [[ ! -e "${FILEPATH}" ]]; then | |
echo 'Downloading dep…' >&2 | |
mkdir -p "${DEST}" | |
curl -sSfLo "${FILEPATH}.tmp$$" "${URL}" | |
chmod +x "${FILEPATH}.tmp$$" | |
mv "${FILEPATH}.tmp$$" "${FILEPATH}" | |
echo 'Done downloading dep.' >&2 | |
fi | |
MONOREPO_PATH="${DEST}:${MONOREPO_PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nix-shell | |
these derivations will be built: | |
/nix/store/2nb5vrc6mvbgpyxkpbzm5lanjzpbkrci-monorepo-env-golang.sh.drv | |
/nix/store/2pq02823q72hmjmhkq46cxlkja831h0w-monorepo-env-dep.sh.drv | |
/nix/store/5lsl272x2a7kwhp6x8hqyi9rp6ccfr0z-monorepo-env-kubectl.sh.drv | |
/nix/store/7dm64w4h7v7ddp32q3kjjgjhnqm99ssj-monorepo-env-zk.sh.drv | |
/nix/store/bi5llbn7r34rxvl9m9cn3c4w8c0ph1hh-monorepo-env-node.sh.drv | |
/nix/store/idv5y1fdnl732w9srvs2gm99j5cx7gjr-monorepo-env-packer.sh.drv | |
/nix/store/ksniryf98ax196b2q6k7sf6ipcg8rc27-monorepo-env-gcloud.sh.drv | |
/nix/store/plfz2y53knr6sic2za2c81nvn3njmmbk-monorepo-env-kafka.sh.drv | |
/nix/store/yy6kxnsg6fsl8h3pf8m4i8whdmvasi94-monorepo-env-yarn.sh.drv | |
/nix/store/z6xp480xh71gm98k09234i7pmr7dlkp4-monorepo-env-zulu.sh.drv | |
building path(s) ‘/nix/store/v9v3z25ip5n7q8qjlaxpd5szjcx9q40f-monorepo-env-dep.sh’ | |
building path(s) ‘/nix/store/xzsxc38sdawdjqwybvl394rl97y3cnks-monorepo-env-gcloud.sh’ | |
building path(s) ‘/nix/store/20fwk129hngzmv5lsp2g95bw3lb4fc7a-monorepo-env-golang.sh’ | |
building path(s) ‘/nix/store/qla4qycmq5ahk7q8z233r1336k5vwbm8-monorepo-env-kafka.sh’ | |
building path(s) ‘/nix/store/7c2gficfnda73lrkvi6ljh1c8zg29hzk-monorepo-env-kubectl.sh’ | |
building path(s) ‘/nix/store/2fpy6zz1jfzbrggq2156aidcw558ycgr-monorepo-env-node.sh’ | |
building path(s) ‘/nix/store/sy55bk1pwq82i1ahhz0jmfgwrfv2731w-monorepo-env-packer.sh’ | |
building path(s) ‘/nix/store/hvgh16v1763azkkslpd7n2h01mg20i58-monorepo-env-yarn.sh’ | |
installing | |
===== BEGIN dep.sh ===== | |
PATH: /nix/store/4ada72n7785wwazv42fhsnxjvilaa3aj-bash-4.4-p12/bin:/nix/store/5afp87hdnsw0a4b96i1iv6wcf455mhh6-curl-7.56.1-dev/bin:/nix/store/cx5qigs283g8rs7bdn84yjwcp6pavxh8-nghttp2-1.24.0-bin/bin:/nix/store/5xdl802xr03c2jcghdfkhwsy7z33ikm4-openssl-1.0.2m-bin/bin:/nix/store/0q3jq9igh4hkqcpybmvzrp1yky1ffadc-curl-7.56.1-bin/bin:/nix/store/r8lmsm8hqm8qxi88djjqibn7k2vlzz86-direnv-2.13.1-bin/bin:/nix/store/ffmkr7pbxdinjbrpm6bkr22gj7midzfx-docker-17.09.0-ce/bin:/nix/store/yjh21h38fmw3i4h2b5r557p4ggbvrd0v-gcc-wrapper-6.4.0/bin:/nix/store/dpza5shcrnf4m8rjsbxb34hf1vnppbbp-gcc-6.4.0/bin:/nix/store/yha4q7zgm6y0ci0b57a8hbmzwyvv1w44-binutils-2.28.1/bin:/nix/store/7vqbmwjv8acb3afqvd9bip13xh6f12ps-glibc-2.26-75-bin/bin:/nix/store/0abay33zgwqgchdzzq6h88ac4963smwf-coreutils-8.28/bin:/nix/store/y4wlvprh1h7wf4nbrjkpvx3mglmk6zx4-git-2.15.0/bin:/nix/store/v12lpsazqg9ms731a5b5wv96vvdrkcr8-hub-2.2.9/bin:/nix/store/83sjcfscbfycaqwb1lzh7gvq4f59inmh-openssh-7.6p1/bin:/nix/store/f6pmgza1hha574hm76p98mc2s6gsn3y8-python-2.7.14/bin:/nix/store/7lx6bha6l22vi5h9c31nri1p7rqs7v1d-gnutar-1.29/bin:/nix/store/glp0czm0l3y6p7asill75pld12k1413h-unzip-6.0/bin:/nix/store/qwzqcspcfyc7avikl4mgwysmdqa65jxx-which-2.21/bin:/nix/store/yhlvb9aiya369qn2r5jz9k1q6qqg5m3w-patchelf-0.9/bin:/nix/store/azzl0bvmzsqc999mg9rgk37pr64wfdz0-paxctl-0.9/bin:/nix/store/0abay33zgwqgchdzzq6h88ac4963smwf-coreutils-8.28/bin:/nix/store/rix7drclds895majp75f4imqh09w9bvb-findutils-4.6.0/bin:/nix/store/jxa512mq3hyrbqwdhlkc7q1xxh538x4z-diffutils-3.6/bin:/nix/store/arcyymlgk8nh0flbb4hb2m287byfswkr-gnused-4.4/bin:/nix/store/jnflx7xcqjkn7lkkr8hiv0y284fdz0qf-gnugrep-3.1/bin:/nix/store/1yqmx3rl2hmz78992i9k8l4y88r42gm1-gawk-4.2.0/bin:/nix/store/7lx6bha6l22vi5h9c31nri1p7rqs7v1d-gnutar-1.29/bin:/nix/store/smx6lirinf04qkm5i9hxrfg9psl7jlsz-gzip-1.8/bin:/nix/store/fw1ixc551hm7mvpfxcmlzr6y1x3ck2hv-bzip2-1.0.6.0.1-bin/bin:/nix/store/caq1vyjkcgfrnxkynizn1bxw1vwazl0n-gnumake-4.2.1/bin:/nix/store/4ada72n7785wwazv42fhsnxjvilaa3aj-bash-4.4-p12/bin:/nix/store/v06ybx67cflsmcgjhs260wzclglrjg0p-patch-2.7.5/bin:/nix/store/r556bjkg62fh4mxpfqpa9rpjcvbylg6z-xz-5.2.3-bin/bin | |
/nix/store/izkijl7w7qkjdfr09qk43v1n3bnbdnvm-stdenv/setup: /nix/store/k8lh39rxkhggmqlids8gpl7s58b0v1j5-dep.sh: /usr/bin/env: bad interpreter: No such file or directory | |
builder for ‘/nix/store/2pq02823q72hmjmhkq46cxlkja831h0w-monorepo-env-dep.sh.drv’ failed with exit code 126 | |
error: build of ‘/nix/store/2pq02823q72hmjmhkq46cxlkja831h0w-monorepo-env-dep.sh.drv’ failed | |
/run/current-system/sw/bin/nix-shell: failed to build all dependencies | |
zsh: exit 100 nix-shell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment