diff --git a/pkgs/build-support/build-fhs-chrootenv/default.nix b/pkgs/build-support/build-fhs-chrootenv/default.nix index 461f4762aba..dfce8edcb23 100644 --- a/pkgs/build-support/build-fhs-chrootenv/default.nix +++ b/pkgs/build-support/build-fhs-chrootenv/default.nix @@ -1,4 +1,4 @@ -{ stdenv } : { env } : +{ stdenv } : { env, extraInstallCommands ? "" } : let # References to shell scripts that set up or tear down the environment @@ -43,5 +43,6 @@ in stdenv.mkDerivation { -e "s|@name@|${name}|g" \ ${destroySh} > destroy-${name}-chrootenv chmod +x destroy-${name}-chrootenv + ${extraInstallCommands} ''; } diff --git a/pkgs/build-support/build-fhs-userenv/default.nix b/pkgs/build-support/build-fhs-userenv/default.nix index 424adf081ca..aa95080ac52 100644 --- a/pkgs/build-support/build-fhs-userenv/default.nix +++ b/pkgs/build-support/build-fhs-userenv/default.nix @@ -1,4 +1,5 @@ -{ runCommand, lib, writeText, writeScriptBin, stdenv, ruby } : { env, runScript ? "bash", extraBindMounts ? [] } : +{ runCommand, lib, writeText, writeScriptBin, stdenv, ruby } : +{ env, runScript ? "bash", extraBindMounts ? [], extraInstallCommands ? "" } : let name = env.pname; @@ -44,4 +45,5 @@ in runCommand name { exec ${chroot-user}/bin/chroot-user ${env} bash -l ${init runScript} "\$(pwd)" "\$@" EOF chmod +x $out/bin/${name} + ${extraInstallCommands} '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1cd2e94402f..44a379a8a38 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -273,13 +273,15 @@ let }; buildFHSChrootEnv = args: chrootFHSEnv { - env = buildFHSEnv args; + env = buildFHSEnv (removeAttrs args [ "extraInstallCommands" ]); + extraInstallCommands = args.extraInstallCommands or ""; }; buildFHSUserEnv = args: userFHSEnv { - env = buildFHSEnv (removeAttrs args [ "runScript" "extraBindMounts" ]); + env = buildFHSEnv (removeAttrs args [ "runScript" "extraBindMounts" "extraInstallCommands" ]); runScript = args.runScript or "bash"; extraBindMounts = args.extraBindMounts or []; + extraInstallCommands = args.extraInstallCommands or ""; }; buildMaven = callPackage ../build-support/build-maven.nix {};