Skip to content

Instantly share code, notes, and snippets.

@pcarrier
Created November 26, 2017 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcarrier/32a6e98c8e6d66b9e44be8abb9816502 to your computer and use it in GitHub Desktop.
Save pcarrier/32a6e98c8e6d66b9e44be8abb9816502 to your computer and use it in GitHub Desktop.
{ 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