treewide: rework Steam-shaped fhsenv building (#428815)
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.91"
|
||||
version = "1.0.98"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8"
|
||||
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||
|
||||
[[package]]
|
||||
name = "goblin"
|
||||
version = "0.9.2"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53ab3f32d1d77146981dea5d6b1e8fe31eedcb7013e5e00d6ccd1259a4b4d923"
|
||||
checksum = "0e961b33649994dcf69303af6b3a332c1228549e604d455d61ec5d2ab5e68d3a"
|
||||
dependencies = [
|
||||
"log",
|
||||
"plain",
|
||||
@@ -21,21 +21,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.11"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
version = "0.4.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
version = "2.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
@@ -45,18 +45,18 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.89"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -74,9 +74,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.18"
|
||||
version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
@@ -89,18 +89,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "scroll"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6"
|
||||
checksum = "c1257cd4248b4132760d6524d6dda4e053bc648c9070b960929bf50cfb1e7add"
|
||||
dependencies = [
|
||||
"scroll_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll_derive"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932"
|
||||
checksum = "22fc4f90c27b57691bbaf11d8ecc7cfbfe98a4da6dbe60226115d322aa80c06e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -109,18 +109,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.213"
|
||||
version = "1.0.219"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1"
|
||||
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.213"
|
||||
version = "1.0.219"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5"
|
||||
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -129,9 +129,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.132"
|
||||
version = "1.0.141"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
|
||||
checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
@@ -141,9 +141,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.85"
|
||||
version = "2.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56"
|
||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -152,9 +152,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.13"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
|
||||
@@ -43,6 +43,8 @@ struct PriorityKey {
|
||||
root_index: usize,
|
||||
}
|
||||
|
||||
const FHSENV_MARKER_FILE: &str = "nix-support/is-fhsenv";
|
||||
|
||||
fn build_reference_map(refs: Vec<RefGraphNode>) -> HashMap<PathBuf, Vec<PathBuf>> {
|
||||
refs.into_iter()
|
||||
.map(|mut gn| {
|
||||
@@ -119,6 +121,11 @@ fn collect_candidate_paths(
|
||||
let mut candidates: HashMap<_, Vec<_>> = HashMap::new();
|
||||
|
||||
for (path, priority) in paths {
|
||||
if path.join(FHSENV_MARKER_FILE).exists() {
|
||||
// is another fhsenv, skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
for entry in WalkDir::new(&path).follow_links(true) {
|
||||
let entry: PathBuf = match entry {
|
||||
Ok(ent) => {
|
||||
@@ -134,7 +141,7 @@ fn collect_candidate_paths(
|
||||
// could be a broken symlink, that's fine, we still want to handle those
|
||||
Some(_) => e
|
||||
.path()
|
||||
.ok_or_else(|| anyhow!("I/O error when walking {path:?}"))?
|
||||
.ok_or_else(|| anyhow!("I/O error when walking {}", path.display()))?
|
||||
.into(),
|
||||
None => {
|
||||
// symlink loop
|
||||
@@ -256,14 +263,30 @@ fn build_env(out: &Path, plan: HashMap<PathBuf, PathBuf>) -> anyhow::Result<()>
|
||||
.parent()
|
||||
.ok_or(anyhow!("destination directory is root"))
|
||||
.with_context(|| {
|
||||
format!("When trying to determine destination directory for {full_dest:?}")
|
||||
format!(
|
||||
"When trying to determine destination directory for {}",
|
||||
full_dest.display()
|
||||
)
|
||||
})?;
|
||||
fs::create_dir_all(dest_dir)
|
||||
.with_context(|| format!("When trying to create directory {dest_dir:?}"))?;
|
||||
ufs::symlink(&src, &full_dest)
|
||||
.with_context(|| format!("When symlinking {src:?} to {full_dest:?}"))?;
|
||||
.with_context(|| format!("When trying to create directory {}", dest_dir.display()))?;
|
||||
ufs::symlink(&src, &full_dest).with_context(|| {
|
||||
format!(
|
||||
"When symlinking {} to {}",
|
||||
src.display(),
|
||||
full_dest.display()
|
||||
)
|
||||
})?;
|
||||
}
|
||||
|
||||
let marker = out.join(FHSENV_MARKER_FILE);
|
||||
fs::create_dir_all(
|
||||
marker
|
||||
.parent()
|
||||
.ok_or(anyhow!("marker file is in root, this should never happen"))?,
|
||||
)?;
|
||||
fs::write(marker, [])?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -283,7 +306,7 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
paths = extend_to_closure(paths, &refs)?;
|
||||
paths32 = extend_to_closure(paths32, &refs)?;
|
||||
};
|
||||
}
|
||||
|
||||
let plan = build_plan(paths, paths32)?;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
legendary-heroic,
|
||||
nile,
|
||||
comet-gog,
|
||||
umu-launcher,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -90,6 +91,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
makeWrapper "${electron}/bin/electron" "$out/bin/heroic" \
|
||||
--inherit-argv0 \
|
||||
--set ELECTRON_FORCE_IS_PACKAGED 1 \
|
||||
--suffix PATH ":" "${umu-launcher}/bin" \
|
||||
--add-flags --disable-gpu-compositing \
|
||||
--add-flags $out/opt/heroic/resources/app.asar \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
|
||||
|
||||
@@ -1,160 +1,22 @@
|
||||
{
|
||||
buildFHSEnv,
|
||||
steam,
|
||||
heroic-unwrapped,
|
||||
extraPkgs ? pkgs: [ ],
|
||||
extraLibraries ? pkgs: [ ],
|
||||
}:
|
||||
|
||||
buildFHSEnv {
|
||||
steam.buildRuntimeEnv {
|
||||
pname = "heroic";
|
||||
inherit (heroic-unwrapped) version;
|
||||
inherit (heroic-unwrapped) version meta;
|
||||
|
||||
runScript = "heroic";
|
||||
|
||||
# Many Wine and native games need 32-bit libraries.
|
||||
multiArch = true;
|
||||
|
||||
# required by Electron
|
||||
unshareIpc = false;
|
||||
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
with pkgs;
|
||||
[
|
||||
heroic-unwrapped
|
||||
gamemode
|
||||
curl
|
||||
gawk
|
||||
zenity
|
||||
kdePackages.kdialog
|
||||
mangohud
|
||||
net-tools
|
||||
opencl-headers
|
||||
p7zip
|
||||
pciutils
|
||||
perl
|
||||
psmisc
|
||||
python3
|
||||
umu-launcher
|
||||
unzip
|
||||
which
|
||||
xorg.xrandr
|
||||
zstd
|
||||
]
|
||||
++ extraPkgs pkgs;
|
||||
|
||||
multiPkgs =
|
||||
let
|
||||
xorgDeps =
|
||||
pkgs: with pkgs.xorg; [
|
||||
libICE
|
||||
libpthreadstubs
|
||||
libSM
|
||||
libX11
|
||||
libXaw
|
||||
libxcb
|
||||
libXcomposite
|
||||
libXcursor
|
||||
libXdmcp
|
||||
libXext
|
||||
libXfixes
|
||||
libXi
|
||||
libXinerama
|
||||
libXmu
|
||||
libXrandr
|
||||
libXrender
|
||||
libXScrnSaver
|
||||
libXt
|
||||
libXtst
|
||||
libXv
|
||||
libXxf86vm
|
||||
];
|
||||
gstreamerDeps =
|
||||
pkgs: with pkgs.gst_all_1; [
|
||||
gstreamer
|
||||
gst-plugins-base
|
||||
gst-plugins-good
|
||||
gst-plugins-ugly
|
||||
gst-plugins-bad
|
||||
gst-libav
|
||||
];
|
||||
in
|
||||
pkgs:
|
||||
with pkgs;
|
||||
[
|
||||
alsa-lib
|
||||
alsa-plugins
|
||||
bash
|
||||
cabextract
|
||||
cairo
|
||||
coreutils
|
||||
cups
|
||||
dbus
|
||||
freealut
|
||||
freetype
|
||||
fribidi
|
||||
giflib
|
||||
glib
|
||||
gnutls
|
||||
gtk3
|
||||
icu
|
||||
lcms2
|
||||
libevdev
|
||||
libgcrypt
|
||||
libGLU
|
||||
libglvnd
|
||||
libgpg-error
|
||||
libgudev
|
||||
libjpeg
|
||||
libkrb5
|
||||
libmpeg2
|
||||
libogg
|
||||
libopus
|
||||
libpng
|
||||
libpulseaudio
|
||||
libselinux
|
||||
libsndfile
|
||||
libtheora
|
||||
libtiff
|
||||
libunwind
|
||||
libusb1
|
||||
libv4l
|
||||
libva
|
||||
libvdpau
|
||||
libvorbis
|
||||
libvpx
|
||||
libwebp
|
||||
libxkbcommon
|
||||
libxml2
|
||||
mpg123
|
||||
ncurses
|
||||
ocl-icd
|
||||
openal
|
||||
openldap
|
||||
openssl
|
||||
pango
|
||||
pipewire
|
||||
samba4
|
||||
sane-backends
|
||||
SDL2
|
||||
speex
|
||||
sqlite
|
||||
udev
|
||||
unixODBC
|
||||
util-linux
|
||||
vulkan-loader
|
||||
wayland
|
||||
zlib
|
||||
]
|
||||
++ xorgDeps pkgs
|
||||
++ gstreamerDeps pkgs
|
||||
++ extraLibraries pkgs;
|
||||
extraPkgs = pkgs: [ heroic-unwrapped ] ++ extraPkgs pkgs;
|
||||
inherit extraLibraries;
|
||||
|
||||
extraInstallCommands = ''
|
||||
mkdir -p $out/share
|
||||
ln -s ${heroic-unwrapped}/share/applications $out/share
|
||||
ln -s ${heroic-unwrapped}/share/icons $out/share
|
||||
'';
|
||||
|
||||
meta = heroic-unwrapped.meta;
|
||||
}
|
||||
|
||||
+159
-129
@@ -13,161 +13,191 @@
|
||||
privateTmp ? true, # if the steam bubblewrap should isolate /tmp
|
||||
}:
|
||||
let
|
||||
steamEnv =
|
||||
buildRuntimeEnv =
|
||||
{
|
||||
name,
|
||||
runScript,
|
||||
passthru ? { },
|
||||
meta ? { },
|
||||
}:
|
||||
buildFHSEnv {
|
||||
inherit
|
||||
name
|
||||
runScript
|
||||
passthru
|
||||
meta
|
||||
privateTmp
|
||||
;
|
||||
extraPkgs ? pkgs: [ ],
|
||||
extraLibraries ? pkgs: [ ],
|
||||
extraProfile ? "",
|
||||
extraPreBwrapCmds ? "",
|
||||
extraBwrapArgs ? [ ],
|
||||
extraEnv ? { },
|
||||
...
|
||||
}@args:
|
||||
buildFHSEnv (
|
||||
(builtins.removeAttrs args [
|
||||
"extraPkgs"
|
||||
"extraLibraries"
|
||||
"extraProfile"
|
||||
"extraPreBwrapCmds"
|
||||
"extraBwrapArgs"
|
||||
"extraArgs"
|
||||
"extraEnv"
|
||||
])
|
||||
// {
|
||||
inherit privateTmp;
|
||||
|
||||
multiArch = true;
|
||||
includeClosures = true;
|
||||
multiArch = true;
|
||||
includeClosures = true;
|
||||
|
||||
# https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#command-line-tools
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
with pkgs;
|
||||
[
|
||||
steam-unwrapped
|
||||
# https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#command-line-tools
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
with pkgs;
|
||||
[
|
||||
bash
|
||||
coreutils
|
||||
file
|
||||
lsb-release # not documented, called from Big Picture
|
||||
pciutils # not documented, complains about lspci on startup
|
||||
glibc_multi.bin
|
||||
xdg-utils # calls xdg-open occasionally
|
||||
xz
|
||||
zenity
|
||||
|
||||
bash
|
||||
coreutils
|
||||
file
|
||||
lsb-release # not documented, called from Big Picture
|
||||
pciutils # not documented, complains about lspci on startup
|
||||
glibc_multi.bin
|
||||
xdg-utils # calls xdg-open occasionally
|
||||
xz
|
||||
zenity
|
||||
# Steam expects it to be /sbin specifically
|
||||
(pkgs.runCommand "sbin-ldconfig" { } ''
|
||||
mkdir -p $out/sbin
|
||||
ln -s /bin/ldconfig $out/sbin/ldconfig
|
||||
'')
|
||||
|
||||
# Steam expects it to be /sbin specifically
|
||||
(pkgs.runCommand "sbin-ldconfig" { } ''
|
||||
mkdir -p $out/sbin
|
||||
ln -s /bin/ldconfig $out/sbin/ldconfig
|
||||
'')
|
||||
# crashes on startup if it can't find libX11 locale files
|
||||
(pkgs.runCommand "xorg-locale" { } ''
|
||||
mkdir -p $out
|
||||
ln -s ${xorg.libX11}/share $out/share
|
||||
'')
|
||||
]
|
||||
++ extraPkgs pkgs;
|
||||
|
||||
# crashes on startup if it can't find libX11 locale files
|
||||
(pkgs.runCommand "xorg-locale" { } ''
|
||||
mkdir -p $out
|
||||
ln -s ${xorg.libX11}/share $out/share
|
||||
'')
|
||||
]
|
||||
++ extraPkgs pkgs;
|
||||
# https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#shared-libraries
|
||||
multiPkgs =
|
||||
pkgs:
|
||||
with pkgs;
|
||||
[
|
||||
glibc
|
||||
libxcrypt
|
||||
libGL
|
||||
|
||||
# https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#shared-libraries
|
||||
multiPkgs =
|
||||
pkgs:
|
||||
with pkgs;
|
||||
[
|
||||
glibc
|
||||
libxcrypt
|
||||
libGL
|
||||
libdrm
|
||||
libgbm
|
||||
udev
|
||||
libudev0-shim
|
||||
libva
|
||||
vulkan-loader
|
||||
|
||||
libdrm
|
||||
libgbm
|
||||
udev
|
||||
libudev0-shim
|
||||
libva
|
||||
vulkan-loader
|
||||
networkmanager
|
||||
# not documented, used for network status things in Big Picture
|
||||
# FIXME: figure out how to only build libnm?
|
||||
libcap # not documented, required by srt-bwrap
|
||||
]
|
||||
++ extraLibraries pkgs;
|
||||
|
||||
networkmanager
|
||||
# not documented, used for network status things in Big Picture
|
||||
# FIXME: figure out how to only build libnm?
|
||||
libcap # not documented, required by srt-bwrap
|
||||
]
|
||||
++ extraLibraries pkgs;
|
||||
profile = ''
|
||||
# prevents log spam from SteamRT GTK trying to load host GIO modules
|
||||
unset GIO_EXTRA_MODULES
|
||||
|
||||
extraInstallCommands = lib.optionalString (steam-unwrapped != null) ''
|
||||
ln -s ${steam-unwrapped}/share $out/share
|
||||
'';
|
||||
# udev event notifications don't work reliably inside containers.
|
||||
# SDL2 already tries to automatically detect flatpak and pressure-vessel
|
||||
# and falls back to inotify-based discovery [1]. We make SDL2 do the
|
||||
# same by telling it explicitly.
|
||||
#
|
||||
# [1] <https://github.com/libsdl-org/SDL/commit/8e2746cfb6e1f1a1da5088241a1440fd2535e321>
|
||||
export SDL_JOYSTICK_DISABLE_UDEV=1
|
||||
|
||||
profile = ''
|
||||
# prevents log spam from SteamRT GTK trying to load host GIO modules
|
||||
unset GIO_EXTRA_MODULES
|
||||
# This is needed for IME (e.g. iBus, fcitx5) to function correctly on non-CJK locales
|
||||
# https://github.com/ValveSoftware/steam-for-linux/issues/781#issuecomment-2004757379
|
||||
export GTK_IM_MODULE='xim'
|
||||
|
||||
# udev event notifications don't work reliably inside containers.
|
||||
# SDL2 already tries to automatically detect flatpak and pressure-vessel
|
||||
# and falls back to inotify-based discovery [1]. We make SDL2 do the
|
||||
# same by telling it explicitly.
|
||||
#
|
||||
# [1] <https://github.com/libsdl-org/SDL/commit/8e2746cfb6e1f1a1da5088241a1440fd2535e321>
|
||||
export SDL_JOYSTICK_DISABLE_UDEV=1
|
||||
# See https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#graphics-driver
|
||||
export LIBGL_DRIVERS_PATH=/run/opengl-driver/lib/dri:/run/opengl-driver-32/lib/dri
|
||||
export __EGL_VENDOR_LIBRARY_DIRS=/run/opengl-driver/share/glvnd/egl_vendor.d:/run/opengl-driver-32/share/glvnd/egl_vendor.d
|
||||
export LIBVA_DRIVERS_PATH=/run/opengl-driver/lib/dri:/run/opengl-driver-32/lib/dri
|
||||
export VDPAU_DRIVER_PATH=/run/opengl-driver/lib/vdpau:/run/opengl-driver-32/lib/vdpau
|
||||
|
||||
# This is needed for IME (e.g. iBus, fcitx5) to function correctly on non-CJK locales
|
||||
# https://github.com/ValveSoftware/steam-for-linux/issues/781#issuecomment-2004757379
|
||||
export GTK_IM_MODULE='xim'
|
||||
|
||||
# See https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#graphics-driver
|
||||
export LIBGL_DRIVERS_PATH=/run/opengl-driver/lib/dri:/run/opengl-driver-32/lib/dri
|
||||
export __EGL_VENDOR_LIBRARY_DIRS=/run/opengl-driver/share/glvnd/egl_vendor.d:/run/opengl-driver-32/share/glvnd/egl_vendor.d
|
||||
export LIBVA_DRIVERS_PATH=/run/opengl-driver/lib/dri:/run/opengl-driver-32/lib/dri
|
||||
export VDPAU_DRIVER_PATH=/run/opengl-driver/lib/vdpau:/run/opengl-driver-32/lib/vdpau
|
||||
|
||||
# Steam gets confused by the symlinks to bind mounts to symlinks /etc/localtime ends up being, so help it out.
|
||||
# See also: https://github.com/flathub/com.valvesoftware.Steam/blob/28481f09f33c12b6ac7421d13af9ed1523c54ec4/steam_wrapper/steam_wrapper.py#L160
|
||||
if [ -z ''${TZ+x} ]; then
|
||||
new_TZ="$(readlink -f /etc/localtime | grep -P -o '(?<=/zoneinfo/).*$')"
|
||||
if [ $? -eq 0 ]; then
|
||||
export TZ="$new_TZ"
|
||||
# Steam gets confused by the symlinks to bind mounts to symlinks /etc/localtime ends up being, so help it out.
|
||||
# See also: https://github.com/flathub/com.valvesoftware.Steam/blob/28481f09f33c12b6ac7421d13af9ed1523c54ec4/steam_wrapper/steam_wrapper.py#L160
|
||||
if [ -z ''${TZ+x} ]; then
|
||||
new_TZ="$(readlink -f /etc/localtime | grep -P -o '(?<=/zoneinfo/).*$')"
|
||||
if [ $? -eq 0 ]; then
|
||||
export TZ="$new_TZ"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
set -a
|
||||
${lib.toShellVars extraEnv}
|
||||
set +a
|
||||
set -a
|
||||
${lib.toShellVars extraEnv}
|
||||
set +a
|
||||
|
||||
${extraProfile}
|
||||
'';
|
||||
${extraProfile}
|
||||
'';
|
||||
|
||||
inherit extraPreBwrapCmds;
|
||||
inherit extraPreBwrapCmds;
|
||||
|
||||
extraBwrapArgs = [
|
||||
# Steam will dump crash reports here, make those more accessible
|
||||
"--bind-try /tmp/dumps /tmp/dumps"
|
||||
]
|
||||
++ extraBwrapArgs;
|
||||
};
|
||||
extraBwrapArgs = [
|
||||
# Steam will dump crash reports here, make those more accessible
|
||||
"--bind-try /tmp/dumps /tmp/dumps"
|
||||
]
|
||||
++ extraBwrapArgs;
|
||||
}
|
||||
);
|
||||
in
|
||||
steamEnv {
|
||||
name = "steam";
|
||||
buildRuntimeEnv {
|
||||
pname = "steam";
|
||||
inherit (steam-unwrapped) version meta;
|
||||
|
||||
extraPkgs = pkgs: [ steam-unwrapped ] ++ extraPkgs pkgs;
|
||||
inherit
|
||||
extraLibraries
|
||||
extraProfile
|
||||
extraPreBwrapCmds
|
||||
extraBwrapArgs
|
||||
extraEnv
|
||||
;
|
||||
|
||||
runScript = writeShellScript "steam-wrapped" ''
|
||||
exec steam ${extraArgs} "$@"
|
||||
'';
|
||||
|
||||
passthru.run = steamEnv {
|
||||
name = "steam-run";
|
||||
extraInstallCommands = ''
|
||||
ln -s ${steam-unwrapped}/share $out/share
|
||||
'';
|
||||
|
||||
runScript = writeShellScript "steam-run" ''
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: steam-run command-to-run args..." >&2
|
||||
exit 1
|
||||
fi
|
||||
passthru =
|
||||
let
|
||||
makeSteamRun =
|
||||
package:
|
||||
buildRuntimeEnv {
|
||||
name = "steam-run";
|
||||
|
||||
exec "$@"
|
||||
'';
|
||||
extraPkgs = pkgs: package ++ extraPkgs pkgs;
|
||||
|
||||
meta = (steam-unwrapped.meta or { }) // {
|
||||
description = "Run commands in the same FHS environment that is used for Steam";
|
||||
mainProgram = "steam-run";
|
||||
name = "steam-run";
|
||||
# steam-run itself is just a script that lives in nixpkgs (which is licensed under MIT).
|
||||
# steam is a dependency and already unfree, so normal steam-run will not install without
|
||||
# allowing unfree packages or appropriate `allowUnfreePredicate` rules.
|
||||
license = lib.licenses.mit;
|
||||
inherit
|
||||
extraLibraries
|
||||
extraProfile
|
||||
extraPreBwrapCmds
|
||||
extraBwrapArgs
|
||||
extraEnv
|
||||
;
|
||||
|
||||
runScript = writeShellScript "steam-run" ''
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: steam-run command-to-run args..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Run commands in the same FHS environment that is used for Steam";
|
||||
mainProgram = "steam-run";
|
||||
name = "steam-run";
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit buildRuntimeEnv;
|
||||
|
||||
run = makeSteamRun [ steam-unwrapped ];
|
||||
run-free = makeSteamRun [ ];
|
||||
};
|
||||
};
|
||||
|
||||
meta = (steam-unwrapped.meta or { }) // {
|
||||
description = "Steam dependencies (dummy package, do not use)";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
buildFHSEnv,
|
||||
lib,
|
||||
steam,
|
||||
umu-launcher-unwrapped,
|
||||
@@ -7,39 +6,28 @@
|
||||
extraLibraries ? pkgs: [ ],
|
||||
extraProfile ? "", # string to append to shell profile
|
||||
extraEnv ? { }, # Environment variables to include in shell profile
|
||||
withMultiArch ? true, # Many Wine games need 32-bit libraries.
|
||||
}:
|
||||
let
|
||||
# Steam is not a dependency, but we re-use some of its implementation
|
||||
steam' = steam.override {
|
||||
inherit extraEnv extraProfile;
|
||||
};
|
||||
in
|
||||
buildFHSEnv {
|
||||
steam.buildRuntimeEnv {
|
||||
pname = "umu-launcher";
|
||||
inherit (umu-launcher-unwrapped) version meta;
|
||||
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
[
|
||||
# Use umu-launcher-unwrapped from the package args, to support overriding
|
||||
umu-launcher-unwrapped
|
||||
]
|
||||
++ extraPkgs pkgs;
|
||||
multiPkgs = extraLibraries;
|
||||
multiArch = withMultiArch;
|
||||
extraPkgs = pkgs: [ umu-launcher-unwrapped ] ++ extraPkgs pkgs;
|
||||
inherit
|
||||
extraLibraries
|
||||
extraProfile
|
||||
extraEnv
|
||||
;
|
||||
|
||||
executableName = umu-launcher-unwrapped.meta.mainProgram;
|
||||
runScript = lib.getExe umu-launcher-unwrapped;
|
||||
|
||||
# Legendary spawns UMU, doesn't wait for it to exit,
|
||||
# and immediately exits itself. This makes it so we can't
|
||||
# die with parent, because parent is already dead.
|
||||
dieWithParent = false;
|
||||
|
||||
extraInstallCommands = ''
|
||||
ln -s ${umu-launcher-unwrapped}/lib $out/lib
|
||||
ln -s ${umu-launcher-unwrapped}/share $out/share
|
||||
'';
|
||||
|
||||
# For umu & proton, we need roughly the same environment as Steam.
|
||||
# For simplicity, we use Steam's `profile` implementation.
|
||||
# See https://github.com/NixOS/nixpkgs/pull/381047
|
||||
# And https://github.com/NixOS/nixpkgs/issues/297662#issuecomment-2647656699
|
||||
inherit (steam'.args) profile;
|
||||
}
|
||||
|
||||
@@ -14918,11 +14918,7 @@ with pkgs;
|
||||
springLobby = callPackage ../games/spring/springlobby.nix { };
|
||||
|
||||
steam-run = steam.run;
|
||||
|
||||
# This exists so Hydra tries to build all of Steam's dependencies.
|
||||
steam-fhsenv-without-steam = steam.override { steam-unwrapped = null; };
|
||||
|
||||
steam-run-free = steam-fhsenv-without-steam.run;
|
||||
steam-run-free = steam.run-free;
|
||||
|
||||
steamback = python3.pkgs.callPackage ../tools/games/steamback { };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user