Loading nixos/modules/programs/steam.nix +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ in { default = pkgs.steam; defaultText = lib.literalExpression "pkgs.steam"; example = lib.literalExpression '' pkgs.steam-small.override { pkgs.steam.override { extraEnv = { MANGOHUD = true; OBS_VKCAPTURE = true; Loading pkgs/applications/editors/vim/common.nix +2 −2 Original line number Diff line number Diff line { lib, fetchFromGitHub }: rec { version = "9.1.0707"; version = "9.1.0765"; outputs = [ "out" "xxd" ]; Loading @@ -8,7 +8,7 @@ rec { owner = "vim"; repo = "vim"; rev = "v${version}"; hash = "sha256-iHOLABPk5B7Sh7EBYnM7wdxnK2Wv7q4WS3FEp780SV4="; hash = "sha256-LtEEMpdWXA6qyjAIjgsZoc4hNXXG2ZXxCsbWKC5aEPI="; }; enableParallelBuilding = true; Loading pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix +3 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ , targetPkgs ? pkgs: [] , multiPkgs ? pkgs: [] , multiArch ? false # Whether to include 32bit packages , includeClosures ? false # Whether to include closures of all packages , nativeBuildInputs ? [] , extraBuildCommands ? "" , extraBuildCommandsMulti ? "" Loading Loading @@ -87,7 +88,6 @@ let etcProfile = writeText "profile" '' export PS1='${name}-fhsenv:\u@\h:\w\$ ' export LOCALE_ARCHIVE='/usr/lib/locale/locale-archive' export LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" export PATH="/run/wrappers/bin:/usr/bin:/usr/sbin:$PATH" export TZDIR='/etc/zoneinfo' Loading Loading @@ -172,6 +172,7 @@ let ${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas fi ''; inherit includeClosures; }; staticUsrProfileMulti = buildEnv { Loading @@ -179,6 +180,7 @@ let paths = baseMultiPaths ++ multiPaths; extraOutputsToInstall = [ "out" "lib" ] ++ extraOutputsToInstall; ignoreCollisions = true; inherit includeClosures; }; # setup library paths only for the targeted architecture Loading pkgs/build-support/build-fhsenv-bubblewrap/container-init.cc 0 → 100644 +63 −0 Original line number Diff line number Diff line #include <fstream> #include <spawn.h> #include <string.h> #include <unistd.h> #include <sys/wait.h> const char LD_SO_CONF[] = R"(/lib /lib/x86_64-linux-gnu /lib64 /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib64 /lib/i386-linux-gnu /lib32 /usr/lib/i386-linux-gnu /usr/lib32 /run/opengl-driver/lib /run/opengl-driver-32/lib )"; int main(int, const char *argv[]) { std::ofstream ld_so_conf; ld_so_conf.open("/etc/ld.so.conf"); ld_so_conf << LD_SO_CONF; ld_so_conf.close(); if (!ld_so_conf) { perror("Failed to generate ld.so.conf"); return 1; } int e; pid_t pid; const char *ldconfig_argv[] = {"/bin/ldconfig", NULL}; char *ldconfig_envp[] = {NULL}; if ((e = posix_spawn(&pid, ldconfig_argv[0], NULL, NULL, (char *const *)ldconfig_argv, ldconfig_envp))) { fprintf(stderr, "Failed to run ldconfig: %s\n", strerror(e)); return 1; } int status; if (waitpid(pid, &status, 0) == -1) { perror("Failed to wait for ldconfig"); return 1; } if (WIFEXITED(status)) { if (WEXITSTATUS(status)) { fprintf(stderr, "ldconfig exited %d\n", WEXITSTATUS(status)); return 1; } } else { fprintf(stderr, "ldconfig killed by signal %d\n", WTERMSIG(status)); return 1; } argv[0] = "/init"; execv(argv[0], (char *const *)argv); perror("Failed to exec stage 2 init"); return 1; } pkgs/build-support/build-fhsenv-bubblewrap/default.nix +25 −22 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ , writeShellScript , glibc , pkgsi686Linux , runCommandCC , coreutils , bubblewrap }: Loading Loading @@ -98,29 +99,30 @@ let ]; in map (path: "/etc/${path}") files; # Create this on the fly instead of linking from /nix # The container might have to modify it and re-run ldconfig if there are # issues running some binary with LD_LIBRARY_PATH createLdConfCache = '' cat > /etc/ld.so.conf <<EOF /lib /lib/x86_64-linux-gnu /lib64 /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib64 /lib/i386-linux-gnu /lib32 /usr/lib/i386-linux-gnu /usr/lib32 /run/opengl-driver/lib /run/opengl-driver-32/lib EOF ldconfig &> /dev/null # Here's the problem case: # - we need to run bash to run the init script # - LD_PRELOAD may be set to another dynamic library, requiring us to discover its dependencies # - oops! ldconfig is part of the init script, and it hasn't run yet # - everything explodes # # In particular, this happens with fhsenvs in fhsenvs, e.g. when running # a wrapped game from Steam. # # So, instead of doing that, we build a tiny static (important!) shim # that executes ldconfig in a completely clean environment to generate # the initial cache, and then execs into the "real" init, which is the # first time we see anything dynamically linked at all. # # Also, the real init is placed strategically at /init, so we don't # have to recompile this every time. containerInit = runCommandCC "container-init" { buildInputs = [ stdenv.cc.libc.static or null ]; } '' $CXX -static -s -o $out ${./container-init.cc} ''; init = run: writeShellScript "${name}-init" '' realInit = run: writeShellScript "${name}-init" '' source /etc/profile ${createLdConfCache} exec ${run} "$@" ''; Loading Loading @@ -253,6 +255,7 @@ let --symlink /etc/ld.so.cache ${glibc}/etc/ld.so.cache \ --ro-bind ${glibc}/etc/rpc ${glibc}/etc/rpc \ --remount-ro ${glibc}/etc \ --symlink ${realInit runScript} /init \ '' + optionalString fhsenv.isMultiBuild (indentLines '' --tmpfs ${pkgsi686Linux.glibc}/etc \ --symlink /etc/ld.so.conf ${pkgsi686Linux.glibc}/etc/ld.so.conf \ Loading @@ -265,7 +268,7 @@ let "''${auto_mounts[@]}" "''${x11_args[@]}" ${concatStringsSep "\n " extraBwrapArgs} ${init runScript} ${initArgs} ${containerInit} ${initArgs} ) exec "''${cmd[@]}" ''; Loading Loading
nixos/modules/programs/steam.nix +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ in { default = pkgs.steam; defaultText = lib.literalExpression "pkgs.steam"; example = lib.literalExpression '' pkgs.steam-small.override { pkgs.steam.override { extraEnv = { MANGOHUD = true; OBS_VKCAPTURE = true; Loading
pkgs/applications/editors/vim/common.nix +2 −2 Original line number Diff line number Diff line { lib, fetchFromGitHub }: rec { version = "9.1.0707"; version = "9.1.0765"; outputs = [ "out" "xxd" ]; Loading @@ -8,7 +8,7 @@ rec { owner = "vim"; repo = "vim"; rev = "v${version}"; hash = "sha256-iHOLABPk5B7Sh7EBYnM7wdxnK2Wv7q4WS3FEp780SV4="; hash = "sha256-LtEEMpdWXA6qyjAIjgsZoc4hNXXG2ZXxCsbWKC5aEPI="; }; enableParallelBuilding = true; Loading
pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix +3 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ , targetPkgs ? pkgs: [] , multiPkgs ? pkgs: [] , multiArch ? false # Whether to include 32bit packages , includeClosures ? false # Whether to include closures of all packages , nativeBuildInputs ? [] , extraBuildCommands ? "" , extraBuildCommandsMulti ? "" Loading Loading @@ -87,7 +88,6 @@ let etcProfile = writeText "profile" '' export PS1='${name}-fhsenv:\u@\h:\w\$ ' export LOCALE_ARCHIVE='/usr/lib/locale/locale-archive' export LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" export PATH="/run/wrappers/bin:/usr/bin:/usr/sbin:$PATH" export TZDIR='/etc/zoneinfo' Loading Loading @@ -172,6 +172,7 @@ let ${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas fi ''; inherit includeClosures; }; staticUsrProfileMulti = buildEnv { Loading @@ -179,6 +180,7 @@ let paths = baseMultiPaths ++ multiPaths; extraOutputsToInstall = [ "out" "lib" ] ++ extraOutputsToInstall; ignoreCollisions = true; inherit includeClosures; }; # setup library paths only for the targeted architecture Loading
pkgs/build-support/build-fhsenv-bubblewrap/container-init.cc 0 → 100644 +63 −0 Original line number Diff line number Diff line #include <fstream> #include <spawn.h> #include <string.h> #include <unistd.h> #include <sys/wait.h> const char LD_SO_CONF[] = R"(/lib /lib/x86_64-linux-gnu /lib64 /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib64 /lib/i386-linux-gnu /lib32 /usr/lib/i386-linux-gnu /usr/lib32 /run/opengl-driver/lib /run/opengl-driver-32/lib )"; int main(int, const char *argv[]) { std::ofstream ld_so_conf; ld_so_conf.open("/etc/ld.so.conf"); ld_so_conf << LD_SO_CONF; ld_so_conf.close(); if (!ld_so_conf) { perror("Failed to generate ld.so.conf"); return 1; } int e; pid_t pid; const char *ldconfig_argv[] = {"/bin/ldconfig", NULL}; char *ldconfig_envp[] = {NULL}; if ((e = posix_spawn(&pid, ldconfig_argv[0], NULL, NULL, (char *const *)ldconfig_argv, ldconfig_envp))) { fprintf(stderr, "Failed to run ldconfig: %s\n", strerror(e)); return 1; } int status; if (waitpid(pid, &status, 0) == -1) { perror("Failed to wait for ldconfig"); return 1; } if (WIFEXITED(status)) { if (WEXITSTATUS(status)) { fprintf(stderr, "ldconfig exited %d\n", WEXITSTATUS(status)); return 1; } } else { fprintf(stderr, "ldconfig killed by signal %d\n", WTERMSIG(status)); return 1; } argv[0] = "/init"; execv(argv[0], (char *const *)argv); perror("Failed to exec stage 2 init"); return 1; }
pkgs/build-support/build-fhsenv-bubblewrap/default.nix +25 −22 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ , writeShellScript , glibc , pkgsi686Linux , runCommandCC , coreutils , bubblewrap }: Loading Loading @@ -98,29 +99,30 @@ let ]; in map (path: "/etc/${path}") files; # Create this on the fly instead of linking from /nix # The container might have to modify it and re-run ldconfig if there are # issues running some binary with LD_LIBRARY_PATH createLdConfCache = '' cat > /etc/ld.so.conf <<EOF /lib /lib/x86_64-linux-gnu /lib64 /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib64 /lib/i386-linux-gnu /lib32 /usr/lib/i386-linux-gnu /usr/lib32 /run/opengl-driver/lib /run/opengl-driver-32/lib EOF ldconfig &> /dev/null # Here's the problem case: # - we need to run bash to run the init script # - LD_PRELOAD may be set to another dynamic library, requiring us to discover its dependencies # - oops! ldconfig is part of the init script, and it hasn't run yet # - everything explodes # # In particular, this happens with fhsenvs in fhsenvs, e.g. when running # a wrapped game from Steam. # # So, instead of doing that, we build a tiny static (important!) shim # that executes ldconfig in a completely clean environment to generate # the initial cache, and then execs into the "real" init, which is the # first time we see anything dynamically linked at all. # # Also, the real init is placed strategically at /init, so we don't # have to recompile this every time. containerInit = runCommandCC "container-init" { buildInputs = [ stdenv.cc.libc.static or null ]; } '' $CXX -static -s -o $out ${./container-init.cc} ''; init = run: writeShellScript "${name}-init" '' realInit = run: writeShellScript "${name}-init" '' source /etc/profile ${createLdConfCache} exec ${run} "$@" ''; Loading Loading @@ -253,6 +255,7 @@ let --symlink /etc/ld.so.cache ${glibc}/etc/ld.so.cache \ --ro-bind ${glibc}/etc/rpc ${glibc}/etc/rpc \ --remount-ro ${glibc}/etc \ --symlink ${realInit runScript} /init \ '' + optionalString fhsenv.isMultiBuild (indentLines '' --tmpfs ${pkgsi686Linux.glibc}/etc \ --symlink /etc/ld.so.conf ${pkgsi686Linux.glibc}/etc/ld.so.conf \ Loading @@ -265,7 +268,7 @@ let "''${auto_mounts[@]}" "''${x11_args[@]}" ${concatStringsSep "\n " extraBwrapArgs} ${init runScript} ${initArgs} ${containerInit} ${initArgs} ) exec "''${cmd[@]}" ''; Loading