buildFHSEnvBubblewrap: allow deeper introspection via passthru

This commit is contained in:
Atemu 2023-03-07 20:35:30 +01:00
parent 422b0ff93b
commit 192c3ecd4b
2 changed files with 11 additions and 6 deletions

View file

@ -1,6 +1,6 @@
{ stdenv, lib, buildEnv, writeText, writeShellScriptBin, pkgs, pkgsi686Linux }: { stdenv, lib, buildEnv, writeText, writeShellScriptBin, pkgs, pkgsi686Linux }:
{ name, profile ? "" args@{ name, profile ? ""
, targetPkgs ? pkgs: [], multiPkgs ? pkgs: [] , targetPkgs ? pkgs: [], multiPkgs ? pkgs: []
, extraBuildCommands ? "", extraBuildCommandsMulti ? "" , extraBuildCommands ? "", extraBuildCommandsMulti ? ""
, extraOutputsToInstall ? [] , extraOutputsToInstall ? []
@ -216,4 +216,8 @@ in stdenv.mkDerivation {
''; '';
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;
passthru = {
inherit args multiPaths targetPaths;
};
} }

View file

@ -19,9 +19,9 @@ args @ {
with builtins; with builtins;
let let
buildFHSEnv = callPackage ./env.nix { }; buildFHSEnv = callPackage ./buildFHSEnv.nix { };
env = buildFHSEnv (removeAttrs args [ fhsenv = buildFHSEnv (removeAttrs args [
"runScript" "extraInstallCommands" "meta" "passthru" "extraBwrapArgs" "dieWithParent" "runScript" "extraInstallCommands" "meta" "passthru" "extraBwrapArgs" "dieWithParent"
"unshareUser" "unshareCgroup" "unshareUts" "unshareNet" "unsharePid" "unshareIpc" "unshareUser" "unshareCgroup" "unshareUts" "unshareNet" "unsharePid" "unshareIpc"
]); ]);
@ -102,7 +102,7 @@ let
ro_mounts=() ro_mounts=()
symlinks=() symlinks=()
etc_ignored=() etc_ignored=()
for i in ${env}/*; do for i in ${fhsenv}/*; do
path="/''${i##*/}" path="/''${i##*/}"
if [[ $path == '/etc' ]]; then if [[ $path == '/etc' ]]; then
: :
@ -115,8 +115,8 @@ let
fi fi
done done
if [[ -d ${env}/etc ]]; then if [[ -d ${fhsenv}/etc ]]; then
for i in ${env}/etc/*; do for i in ${fhsenv}/etc/*; do
path="/''${i##*/}" path="/''${i##*/}"
# NOTE: we're binding /etc/fonts and /etc/ssl/certs from the host so we # NOTE: we're binding /etc/fonts and /etc/ssl/certs from the host so we
# don't want to override it with a path from the FHS environment. # don't want to override it with a path from the FHS environment.
@ -215,6 +215,7 @@ in runCommandLocal name {
echo >&2 "" echo >&2 ""
exit 1 exit 1
''; '';
inherit args fhsenv;
}; };
} '' } ''
mkdir -p $out/bin mkdir -p $out/bin