From da38314be64fe75979964ed245f7d598c517de93 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Wed, 21 Oct 2015 15:57:58 +0300 Subject: [PATCH] buildFHSEnv: create /etc/profile with writeText This should avoid accidential expansion of variables, i.e. in "export PATH=/some/path:$PATH" $PATH would have been expanded in the environment builder! --- pkgs/build-support/build-fhs-chrootenv/env.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/build-fhs-chrootenv/env.nix b/pkgs/build-support/build-fhs-chrootenv/env.nix index 3acb0c8e6b7d..a245778bf386 100644 --- a/pkgs/build-support/build-fhs-chrootenv/env.nix +++ b/pkgs/build-support/build-fhs-chrootenv/env.nix @@ -52,6 +52,14 @@ let gnutar gzip bzip2 xz glibcLocales ]; + etcProfile = nixpkgs.writeText "profile" '' + export PS1='${name}-chrootenv:\u@\h:\w\$ ' + export LOCALE_ARCHIVE='/usr/lib${if isMultiBuild then "64" else ""}/locale/locale-archive' + export LD_LIBRARY_PATH=/run/opengl-driver/lib:/run/opengl-driver-32/lib:/lib:/lib64 + export PATH='/usr/bin:/usr/sbin' + ${profile} + ''; + # Compose /etc for the chroot environment etcPkg = nixpkgs.stdenv.mkDerivation { name = "${name}-chrootenv-etc"; @@ -60,13 +68,7 @@ let cd $out/etc # environment variables - cat >> profile <