Skip to content

Commit 858fa00

Browse files
committed
fix: better desktop shortcut
1 parent de9abeb commit 858fa00

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

default.nix

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
}:
44
let
55
vortexVersion = "1.13.7";
6+
homeDir = builtins.getEnv "HOME";
7+
winePrefix = "${homeDir}/.vortex-linux/compatdata/pfx";
68

79
vortexInstaller = builtins.fetchurl {
810
url = "https://github.com/Nexus-Mods/Vortex/releases/download/v${vortexVersion}/vortex-setup-${vortexVersion}.exe";
@@ -18,21 +20,27 @@ let
1820
umuLauncher = "${pkgs.umu-launcher}";
1921
vortexInstaller = "${vortexInstaller}";
2022
dotnetInstaller = "${dotnetInstaller}";
23+
winePrefix = "${winePrefix}";
2124
};
2225

23-
2426
preInstall = pkgs.writeShellScriptBin "vortex-install" ''
2527
exec ${installScript}
2628
'';
2729

28-
vortexWrapperScript = pkgs.replaceVars ./vortex-wrapper.sh {
29-
umuLauncher = "${pkgs.umu-launcher}";
30-
};
30+
vortexWrapperScript = pkgs.writeShellScript "vortex-wrapper.sh" ''
31+
#!/usr/bin/env bash
32+
set -euo pipefail
33+
34+
export WINEPREFIX="${winePrefix}"
35+
36+
exec ${pkgs.steam-run}/bin/steam-run ${pkgs.umu-launcher}/bin/umu-run "$WINEPREFIX/drive_c/Program Files/Black Tree Gaming Ltd/Vortex/Vortex.exe" "$@"
37+
'';
3138

3239
installPhaseScript = pkgs.replaceVars ./install-phase.sh {
3340
vortexWrapperScript = "${vortexWrapperScript}";
3441
desktopItem = "${./vortex.desktop}";
3542
desktopItemIcon = "${./vortex.ico}";
43+
homeDir = "${homeDir}";
3644
};
3745

3846
in

install-phase.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
set -euo pipefail
44

5-
# Create output directories
6-
mkdir -p "$out/bin"
75
mkdir -p "$out/share/applications"
86

9-
107
cp "@vortexWrapperScript@" "$out/share/applications/vortex-wrapper.sh"
118
chmod +x "$out/share/applications/vortex-wrapper.sh"
12-
cp "@desktopItem@" "$out/share/applications/vortex.desktop"
9+
sed "s|\$out|$out|g" "@desktopItem@" | \
10+
sed "s|\$home|@homeDir@|g" > temp
11+
mv temp "$out/share/applications/vortex.desktop"
1312
cp "@desktopItemIcon@" "$out/share/applications/vortex.ico"

pre-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -euxo pipefail
44

5-
export WINEPREFIX="$HOME/.vortex-linux/compatdata/pfx"
5+
export WINEPREFIX=@winePrefix@
66

77
mkdir -p "$WINEPREFIX"
88

vortex-wrapper.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

vortex.desktop

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Name=Vortex
55
MimeType=x-scheme-handler/nxm;x-scheme-handler/nxm-protocol
66
Terminal=false
77
X-KeepTerminal=false
8-
Path=$HOME/.vortex-linux/compatdata/pfx/drive_c/Program Files/Black Tree Gaming Ltd/Vortex
9-
Exec=vortex-wrapper.sh -d %u
10-
Icon=vortex.ico
8+
Path=$home/.vortex-linux/compatdata/pfx/drive_c/Program Files/Black Tree Gaming Ltd/Vortex
9+
Exec=$out/share/applications/vortex-wrapper.sh
10+
Icon=$out/share/applications/vortex.ico

0 commit comments

Comments
 (0)