buildFHS{Chroot,User}Env: support extraInstallCommands

This commit is contained in:
Nikolay Amiantov 2015-12-04 00:25:59 +03:00
parent 634c9db4c2
commit 00f6ce133c
3 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,4 @@
{ stdenv } : { env } : { stdenv } : { env, extraInstallCommands ? "" } :
let let
# References to shell scripts that set up or tear down the environment # References to shell scripts that set up or tear down the environment
@ -43,5 +43,6 @@ in stdenv.mkDerivation {
-e "s|@name@|${name}|g" \ -e "s|@name@|${name}|g" \
${destroySh} > destroy-${name}-chrootenv ${destroySh} > destroy-${name}-chrootenv
chmod +x destroy-${name}-chrootenv chmod +x destroy-${name}-chrootenv
${extraInstallCommands}
''; '';
} }

View File

@ -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 let
name = env.pname; name = env.pname;
@ -44,4 +45,5 @@ in runCommand name {
exec ${chroot-user}/bin/chroot-user ${env} bash -l ${init runScript} "\$(pwd)" "\$@" exec ${chroot-user}/bin/chroot-user ${env} bash -l ${init runScript} "\$(pwd)" "\$@"
EOF EOF
chmod +x $out/bin/${name} chmod +x $out/bin/${name}
${extraInstallCommands}
'' ''

View File

@ -273,13 +273,15 @@ let
}; };
buildFHSChrootEnv = args: chrootFHSEnv { buildFHSChrootEnv = args: chrootFHSEnv {
env = buildFHSEnv args; env = buildFHSEnv (removeAttrs args [ "extraInstallCommands" ]);
extraInstallCommands = args.extraInstallCommands or "";
}; };
buildFHSUserEnv = args: userFHSEnv { buildFHSUserEnv = args: userFHSEnv {
env = buildFHSEnv (removeAttrs args [ "runScript" "extraBindMounts" ]); env = buildFHSEnv (removeAttrs args [ "runScript" "extraBindMounts" "extraInstallCommands" ]);
runScript = args.runScript or "bash"; runScript = args.runScript or "bash";
extraBindMounts = args.extraBindMounts or []; extraBindMounts = args.extraBindMounts or [];
extraInstallCommands = args.extraInstallCommands or "";
}; };
buildMaven = callPackage ../build-support/build-maven.nix {}; buildMaven = callPackage ../build-support/build-maven.nix {};