Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Last active April 14, 2020 03:51
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 chris-martin/f232fb7fc385d2f469e0c58f0892eb80 to your computer and use it in GitHub Desktop.
Save chris-martin/f232fb7fc385d2f469e0c58f0892eb80 to your computer and use it in GitHub Desktop.
{ coreutils, writeShellScript, lib, system, glibcLocales }:
rec {
inherit (builtins) derivation;
inherit (lib) concatMapStringsSep;
standardBuildInputs = [ coreutils ];
locale = { LC_ALL = "en_US.UTF-8"; LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; };
run = { name, command, env ? {}, buildInputs ? [], outputs ? ["out"] }: rec {
drv = derivation drvArgs;
drvArgs = locale // env // { inherit name builder PATH system outputs; };
builder = writeShellScript "builder-for-${name}" command;
PATH = concatMapStringsSep ":" (x: "${x}/bin") (buildInputs ++ standardBuildInputs);
}.drv;
}.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment