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!
This commit is contained in:
parent
db0589b9fc
commit
da38314be6
@ -52,6 +52,14 @@ let
|
|||||||
gnutar gzip bzip2 xz glibcLocales
|
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
|
# Compose /etc for the chroot environment
|
||||||
etcPkg = nixpkgs.stdenv.mkDerivation {
|
etcPkg = nixpkgs.stdenv.mkDerivation {
|
||||||
name = "${name}-chrootenv-etc";
|
name = "${name}-chrootenv-etc";
|
||||||
@ -60,13 +68,7 @@ let
|
|||||||
cd $out/etc
|
cd $out/etc
|
||||||
|
|
||||||
# environment variables
|
# environment variables
|
||||||
cat >> profile <<EOF
|
ln -s ${etcProfile} 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}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# compatibility with NixOS
|
# compatibility with NixOS
|
||||||
ln -s /host-etc/static static
|
ln -s /host-etc/static static
|
||||||
|
Loading…
x
Reference in New Issue
Block a user