From 192c3ecd4bcc317c3d8868d3c944a75de0dee32e Mon Sep 17 00:00:00 2001 From: Atemu Date: Tue, 7 Mar 2023 20:35:30 +0100 Subject: [PATCH] buildFHSEnvBubblewrap: allow deeper introspection via passthru --- .../{env.nix => buildFHSEnv.nix} | 6 +++++- .../build-fhs-userenv-bubblewrap/default.nix | 11 ++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) rename pkgs/build-support/build-fhs-userenv-bubblewrap/{env.nix => buildFHSEnv.nix} (98%) diff --git a/pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix b/pkgs/build-support/build-fhs-userenv-bubblewrap/buildFHSEnv.nix similarity index 98% rename from pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix rename to pkgs/build-support/build-fhs-userenv-bubblewrap/buildFHSEnv.nix index c4d967a11c69..0d98c0a2bc64 100644 --- a/pkgs/build-support/build-fhs-userenv-bubblewrap/env.nix +++ b/pkgs/build-support/build-fhs-userenv-bubblewrap/buildFHSEnv.nix @@ -1,6 +1,6 @@ { stdenv, lib, buildEnv, writeText, writeShellScriptBin, pkgs, pkgsi686Linux }: -{ name, profile ? "" +args@{ name, profile ? "" , targetPkgs ? pkgs: [], multiPkgs ? pkgs: [] , extraBuildCommands ? "", extraBuildCommandsMulti ? "" , extraOutputsToInstall ? [] @@ -216,4 +216,8 @@ in stdenv.mkDerivation { ''; preferLocalBuild = true; allowSubstitutes = false; + + passthru = { + inherit args multiPaths targetPaths; + }; } diff --git a/pkgs/build-support/build-fhs-userenv-bubblewrap/default.nix b/pkgs/build-support/build-fhs-userenv-bubblewrap/default.nix index 76e68573faa8..290ad35c0640 100644 --- a/pkgs/build-support/build-fhs-userenv-bubblewrap/default.nix +++ b/pkgs/build-support/build-fhs-userenv-bubblewrap/default.nix @@ -19,9 +19,9 @@ args @ { with builtins; let - buildFHSEnv = callPackage ./env.nix { }; + buildFHSEnv = callPackage ./buildFHSEnv.nix { }; - env = buildFHSEnv (removeAttrs args [ + fhsenv = buildFHSEnv (removeAttrs args [ "runScript" "extraInstallCommands" "meta" "passthru" "extraBwrapArgs" "dieWithParent" "unshareUser" "unshareCgroup" "unshareUts" "unshareNet" "unsharePid" "unshareIpc" ]); @@ -102,7 +102,7 @@ let ro_mounts=() symlinks=() etc_ignored=() - for i in ${env}/*; do + for i in ${fhsenv}/*; do path="/''${i##*/}" if [[ $path == '/etc' ]]; then : @@ -115,8 +115,8 @@ let fi done - if [[ -d ${env}/etc ]]; then - for i in ${env}/etc/*; do + if [[ -d ${fhsenv}/etc ]]; then + for i in ${fhsenv}/etc/*; do path="/''${i##*/}" # 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. @@ -215,6 +215,7 @@ in runCommandLocal name { echo >&2 "" exit 1 ''; + inherit args fhsenv; }; } '' mkdir -p $out/bin