Created
November 26, 2017 17:46
-
-
Save pcarrier/32a6e98c8e6d66b9e44be8abb9816502 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}"; | |
__impure = true; | |
buildInputs = tools; | |
buildCommand = '' | |
MONOREPO_INSTALL_DIR=$out ${pkgs.bash}/bin/bash ${scriptPath} | |
''; | |
}; | |
envNames = builtins.attrNames (builtins.readDir envScripts); | |
envPkgs = map mkEnvPackage envNames; | |
in | |
pkgs.buildEnv { | |
name = "monorepo-env"; | |
paths = envPkgs ++ tools; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment