Merge pull request #240860 from Atemu/fhsenv-no-multiarch
buildFHSEnv: disable multiArch by default
This commit is contained in:
commit
67eec418ab
22 changed files with 76 additions and 40 deletions
|
@ -11,6 +11,8 @@ Accepted arguments are:
|
|||
Packages to be installed for the main host's architecture (i.e. x86_64 on x86_64 installations). Along with libraries binaries are also installed.
|
||||
- `multiPkgs`
|
||||
Packages to be installed for all architectures supported by a host (i.e. i686 and x86_64 on x86_64 installations). Only libraries are installed by default.
|
||||
- `multiArch`
|
||||
Whether to install 32bit multiPkgs into the FHSEnv in 64bit environments
|
||||
- `extraBuildCommands`
|
||||
Additional commands to be executed for finalizing the directory structure.
|
||||
- `extraBuildCommandsMulti`
|
||||
|
|
|
@ -16,7 +16,7 @@ let
|
|||
in appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = pkgs: appimageTools.defaultFhsEnvArgs.multiPkgs pkgs ++ [ pkgs.bash ];
|
||||
|
||||
extraInstallCommands = ''
|
||||
|
|
|
@ -28,7 +28,7 @@ let
|
|||
in appimageTools.wrapType2 rec {
|
||||
inherit name src;
|
||||
|
||||
multiPkgs = null; # no p32bit needed
|
||||
multiArch = false; # no p32bit needed
|
||||
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
|
||||
|
||||
extraInstallCommands = ''
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
}:
|
||||
|
||||
let fhsEnv = {
|
||||
# Many WINE games need 32bit
|
||||
multiArch = true;
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
bottles-unwrapped
|
||||
# This only allows to enable the toggle, vkBasalt won't work if not installed with environment.systemPackages (or nix-env)
|
||||
|
|
|
@ -14,7 +14,7 @@ in appimageTools.wrapAppImage rec {
|
|||
};
|
||||
};
|
||||
|
||||
multiPkgs = null;
|
||||
multiArch = false;
|
||||
extraPkgs = p: (appimageTools.defaultFhsEnvArgs.multiPkgs p) ++ [
|
||||
p.glib
|
||||
];
|
||||
|
|
|
@ -47,7 +47,7 @@ let
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/{${name},${pname}}
|
||||
|
|
|
@ -18,6 +18,9 @@ in buildFHSEnv {
|
|||
|
||||
runScript = "lutris";
|
||||
|
||||
# Many native and WINE games need 32bit
|
||||
multiArch = true;
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
lutris-unwrapped
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ appimageTools.wrapType2 rec {
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = p: (appimageTools.defaultFhsEnvArgs.multiPkgs p) ++ [
|
||||
p.libsecret
|
||||
p.xorg.libxkbfile
|
||||
|
|
|
@ -26,7 +26,7 @@ appimageTools.wrapType2 rec {
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = p: (appimageTools.defaultFhsEnvArgs.multiPkgs p) ++ [ p.at-spi2-atk p.at-spi2-core ];
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/{${name},${pname}}
|
||||
|
|
|
@ -21,7 +21,7 @@ in
|
|||
appimageTools.wrapType2 rec {
|
||||
inherit name src;
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = pkgs: (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ [ texlive pandoc ];
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/{${name},${pname}}
|
||||
|
|
|
@ -17,7 +17,7 @@ appimageTools.wrapType2 rec {
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
|
||||
extraInstallCommands = "mv $out/bin/{${name},${pname}}";
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ let
|
|||
in appimageTools.wrapType2 {
|
||||
inherit pname src version;
|
||||
|
||||
multiPkgs = null;
|
||||
multiArch = false;
|
||||
extraPkgs = pkgs: appimageTools.defaultFhsEnvArgs.multiPkgs pkgs ++ [ pkgs.bash ];
|
||||
|
||||
extraInstallCommands = ''
|
||||
|
|
|
@ -27,7 +27,7 @@ let
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
|
||||
extraInstallCommands =
|
||||
let appimageContents = appimageTools.extractType2 { inherit name src; }; in
|
||||
|
|
|
@ -20,7 +20,7 @@ in appimageTools.wrapType2 rec {
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null;
|
||||
multiArch = false;
|
||||
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/{${name},${pname}}
|
||||
|
|
|
@ -31,7 +31,7 @@ in appimageTools.wrapType2 rec {
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = appimageTools.defaultFhsEnvArgs.multiPkgs;
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/{${pname}-${version},${pname}}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
, profile ? ""
|
||||
, targetPkgs ? pkgs: []
|
||||
, multiPkgs ? pkgs: []
|
||||
, multiArch ? false # Whether to include 32bit packages
|
||||
, extraBuildCommands ? ""
|
||||
, extraBuildCommandsMulti ? ""
|
||||
, extraOutputsToInstall ? []
|
||||
|
@ -35,8 +36,8 @@
|
|||
let
|
||||
inherit (stdenv) is64bit;
|
||||
|
||||
# use of glibc_multi is only supported on x86_64-linux
|
||||
isMultiBuild = multiPkgs != null && stdenv.isx86_64 && stdenv.isLinux;
|
||||
# "use of glibc_multi is only supported on x86_64-linux"
|
||||
isMultiBuild = multiArch && stdenv.system == "x86_64-linux";
|
||||
isTargetBuild = !isMultiBuild;
|
||||
|
||||
# list of packages (usually programs) which are only be installed for the
|
||||
|
@ -51,21 +52,34 @@ let
|
|||
# these match the host's architecture, glibc_multi is used for multilib
|
||||
# builds. glibcLocales must be before glibc or glibc_multi as otherwiese
|
||||
# the wrong LOCALE_ARCHIVE will be used where only C.UTF-8 is available.
|
||||
basePkgs = with pkgs;
|
||||
[ glibcLocales
|
||||
(if isMultiBuild then glibc_multi else glibc)
|
||||
(toString gcc.cc.lib) bashInteractiveFHS coreutils less shadow su
|
||||
gawk diffutils findutils gnused gnugrep
|
||||
gnutar gzip bzip2 xz
|
||||
];
|
||||
baseMultiPkgs = with pkgsi686Linux;
|
||||
[ (toString gcc.cc.lib)
|
||||
];
|
||||
basePkgs = with pkgs; [
|
||||
glibcLocales
|
||||
(if isMultiBuild then glibc_multi else glibc)
|
||||
(toString gcc.cc.lib)
|
||||
bashInteractiveFHS
|
||||
coreutils
|
||||
less
|
||||
shadow
|
||||
su
|
||||
gawk
|
||||
diffutils
|
||||
findutils
|
||||
gnused
|
||||
gnugrep
|
||||
gnutar
|
||||
gzip
|
||||
bzip2
|
||||
xz
|
||||
];
|
||||
baseMultiPkgs = with pkgsi686Linux; [
|
||||
(toString gcc.cc.lib)
|
||||
];
|
||||
|
||||
ldconfig = writeShellScriptBin "ldconfig" ''
|
||||
# due to a glibc bug, 64-bit ldconfig complains about patchelf'd 32-bit libraries, so we're using 32-bit ldconfig
|
||||
exec ${if stdenv.isx86_64 && stdenv.isLinux then pkgsi686Linux.glibc.bin else pkgs.glibc.bin}/bin/ldconfig -f /etc/ld.so.conf -C /etc/ld.so.cache "$@"
|
||||
exec ${if stdenv.system == "x86_64-linux" then pkgsi686Linux.glibc.bin else pkgs.glibc.bin}/bin/ldconfig -f /etc/ld.so.conf -C /etc/ld.so.cache "$@"
|
||||
'';
|
||||
|
||||
etcProfile = writeText "profile" ''
|
||||
export PS1='${name}-chrootenv:\u@\h:\w\$ '
|
||||
export LOCALE_ARCHIVE='/usr/lib/locale/locale-archive'
|
||||
|
@ -104,7 +118,7 @@ let
|
|||
# Compose /etc for the chroot environment
|
||||
etcPkg = runCommandLocal "${name}-chrootenv-etc" { } ''
|
||||
mkdir -p $out/etc
|
||||
cd $out/etc
|
||||
pushd $out/etc
|
||||
|
||||
# environment variables
|
||||
ln -s ${etcProfile} profile
|
||||
|
@ -172,13 +186,18 @@ let
|
|||
ln -s lib64 lib
|
||||
|
||||
# copy glibc stuff
|
||||
cp -rsHf ${staticUsrProfileTarget}/lib/32/* lib32/ && chmod u+w -R lib32/
|
||||
cp -rsHf ${staticUsrProfileTarget}/lib/32/* lib32/
|
||||
chmod u+w -R lib32/
|
||||
|
||||
# copy content of multiPaths (32bit libs)
|
||||
[ -d ${staticUsrProfileMulti}/lib ] && cp -rsHf ${staticUsrProfileMulti}/lib/* lib32/ && chmod u+w -R lib32/
|
||||
if [ -d ${staticUsrProfileMulti}/lib ]; then
|
||||
cp -rsHf ${staticUsrProfileMulti}/lib/* lib32/
|
||||
chmod u+w -R lib32/
|
||||
fi
|
||||
|
||||
# copy content of targetPaths (64bit libs)
|
||||
cp -rsHf ${staticUsrProfileTarget}/lib/* lib64/ && chmod u+w -R lib64/
|
||||
cp -rsHf ${staticUsrProfileTarget}/lib/* lib64/
|
||||
chmod u+w -R lib64/
|
||||
|
||||
# symlink 32-bit ld-linux.so
|
||||
ln -Ls ${staticUsrProfileTarget}/lib/32/ld-linux.so.2 lib/
|
||||
|
@ -191,13 +210,15 @@ let
|
|||
# the target profile is the actual profile that will be used for the chroot
|
||||
setupTargetProfile = ''
|
||||
mkdir -m0755 usr
|
||||
cd usr
|
||||
pushd usr
|
||||
|
||||
${setupLibDirs}
|
||||
${lib.optionalString isMultiBuild ''
|
||||
|
||||
'' + lib.optionalString isMultiBuild ''
|
||||
if [ -d "${staticUsrProfileMulti}/share" ]; then
|
||||
cp -rLf ${staticUsrProfileMulti}/share share
|
||||
fi
|
||||
''}
|
||||
'' + ''
|
||||
if [ -d "${staticUsrProfileTarget}/share" ]; then
|
||||
if [ -d share ]; then
|
||||
chmod -R 755 share
|
||||
|
@ -223,18 +244,19 @@ let
|
|||
ln -s "$i"
|
||||
fi
|
||||
done
|
||||
|
||||
popd
|
||||
'';
|
||||
|
||||
in runCommandLocal "${name}-fhs" {
|
||||
passthru = {
|
||||
inherit args multiPaths targetPaths;
|
||||
inherit args multiPaths targetPaths ldconfig;
|
||||
};
|
||||
} ''
|
||||
mkdir -p $out
|
||||
cd $out
|
||||
pushd $out
|
||||
|
||||
${setupTargetProfile}
|
||||
cd $out
|
||||
${extraBuildCommands}
|
||||
cd $out
|
||||
${lib.optionalString isMultiBuild extraBuildCommandsMulti}
|
||||
''
|
||||
|
|
|
@ -14,7 +14,7 @@ buildFHSEnv {
|
|||
pyserial
|
||||
]))
|
||||
]);
|
||||
multiPkgs = null;
|
||||
multiArch = false;
|
||||
|
||||
extraInstallCommands = ''
|
||||
${lib.optionalString withGui ''
|
||||
|
|
|
@ -18,7 +18,7 @@ in
|
|||
appimageTools.wrapType2 {
|
||||
inherit name src;
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = pkgs: appimageTools.defaultFhsEnvArgs.multiPkgs pkgs ++ [ pkgs.bash ];
|
||||
|
||||
extraInstallCommands = ''
|
||||
|
|
|
@ -21,7 +21,7 @@ appimageTools.wrapType2 {
|
|||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = pkgs: appimageTools.defaultFhsEnvArgs.multiPkgs pkgs ++ [ pkgs.bash ];
|
||||
|
||||
extraInstallCommands = ''
|
||||
|
|
|
@ -9,6 +9,9 @@ buildFHSEnv {
|
|||
|
||||
runScript = "heroic";
|
||||
|
||||
# Many Wine and native games need 32-bit libraries.
|
||||
multiArch = true;
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
heroic-unwrapped
|
||||
gamemode
|
||||
|
|
|
@ -61,6 +61,9 @@ let
|
|||
in buildFHSEnv rec {
|
||||
name = "steam";
|
||||
|
||||
# Steam still needs 32bit and various native games do too
|
||||
multiArch = true;
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
steam
|
||||
# License agreement
|
||||
|
|
|
@ -28,7 +28,7 @@ in appimageTools.wrapAppImage {
|
|||
inherit pname version;
|
||||
src = appimageContents;
|
||||
|
||||
multiPkgs = null; # no 32bit needed
|
||||
multiArch = false; # no 32bit needed
|
||||
extraPkgs = { pkgs, ... }@args: [
|
||||
pkgs.hidapi
|
||||
] ++ appimageTools.defaultFhsEnvArgs.multiPkgs args;
|
||||
|
|
Loading…
Reference in a new issue