mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
Merge pull request #69057 from volth/ld-linux
add config.environment.ld-linux
This commit is contained in:
commit
3a7fe07e3c
1 changed files with 32 additions and 1 deletions
|
@ -162,6 +162,16 @@ in
|
||||||
<literal>/usr/bin/env</literal>.
|
<literal>/usr/bin/env</literal>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.ld-linux = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
|
visible = false;
|
||||||
|
description = ''
|
||||||
|
Install symlink to ld-linux(8) system-wide to allow running unmodified ELF binaries.
|
||||||
|
It might be useful to run games or executables distributed inside jar files.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,9 +205,30 @@ in
|
||||||
''
|
''
|
||||||
else ''
|
else ''
|
||||||
rm -f /usr/bin/env
|
rm -f /usr/bin/env
|
||||||
rmdir --ignore-fail-on-non-empty /usr/bin /usr
|
rmdir -p /usr/bin || true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
system.activationScripts.ld-linux =
|
||||||
|
concatStrings (
|
||||||
|
mapAttrsToList
|
||||||
|
(target: source:
|
||||||
|
if config.environment.ld-linux then ''
|
||||||
|
mkdir -m 0755 -p $(dirname ${target})
|
||||||
|
ln -sfn ${escapeShellArg source} ${target}.tmp
|
||||||
|
mv -f ${target}.tmp ${target} # atomically replace
|
||||||
|
'' else ''
|
||||||
|
rm -f ${target}
|
||||||
|
rmdir $(dirname ${target}) || true
|
||||||
|
'')
|
||||||
|
{
|
||||||
|
"i686-linux" ."/lib/ld-linux.so.2" = "${pkgs.glibc.out}/lib/ld-linux.so.2";
|
||||||
|
"x86_64-linux" ."/lib/ld-linux.so.2" = "${pkgs.pkgsi686Linux.glibc.out}/lib/ld-linux.so.2";
|
||||||
|
"x86_64-linux" ."/lib64/ld-linux-x86-64.so.2" = "${pkgs.glibc.out}/lib64/ld-linux-x86-64.so.2";
|
||||||
|
"aarch64-linux"."/lib/ld-linux-aarch64.so.1" = "${pkgs.glibc.out}/lib/ld-linux-aarch64.so.1";
|
||||||
|
"armv7l-linux" ."/lib/ld-linux-armhf.so.3" = "${pkgs.glibc.out}/lib/ld-linux-armhf.so.3";
|
||||||
|
}.${pkgs.stdenv.system} or {}
|
||||||
|
);
|
||||||
|
|
||||||
system.activationScripts.specialfs =
|
system.activationScripts.specialfs =
|
||||||
''
|
''
|
||||||
specialMount() {
|
specialMount() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue