Skip to content

Instantly share code, notes, and snippets.

@necrophcodr
Created August 24, 2024 14:56
Show Gist options
  • Save necrophcodr/a5758a040fe466b27f2dfc755f5ccf00 to your computer and use it in GitHub Desktop.
Save necrophcodr/a5758a040fe466b27f2dfc755f5ccf00 to your computer and use it in GitHub Desktop.
mo2installer NixOS
{ fetchFromGitHub, lib, pkgs, stdenv, ... }:
let
steam-redirector = (pkgs.callPackage ./steam-redirector.nix { inherit pkgs; });
in
stdenv.mkDerivation rec {
pname = "mo2installer";
version = "5.0.3";
src = fetchFromGitHub {
owner = "rockerbacon";
repo = "modorganizer2-linux-installer";
rev = "90d33013aca0deceaadc099be4d682e08f237ef5";
sha256 = "sha256-RYN5/t5Hmzu+Tol9iJ+xDmLGY9sAkLTU0zY6UduJ4i0=";
};
buildInputs = with pkgs; [
bash
curl
p7zip
protontricks
gnome.zenity
];
nativeBuildInputs = [ pkgs.makeWrapper ];
dontBuild = true;
installPhase = ''
mkdir -p "$out/bin"
mv "install.sh" "${pname}"
cp -r ./* "$out/bin"
cp -r ${steam-redirector}/main.exe $out/bin/steam-redirector
wrapProgram $out/bin/${pname} --prefix PATH : ${lib.makeBinPath (with pkgs; [
bash
curl
p7zip
protontricks
gnome.zenity
])}
'';
}
diff --git a/steam-redirector/Makefile b/steam-redirector/Makefile
index c0116b3..7ee986d 100644
--- a/steam-redirector/Makefile
+++ b/steam-redirector/Makefile
@@ -1,6 +1,6 @@
GNU_C=gcc
WIN_C=x86_64-w64-mingw32-gcc
-WIN_FLAGS=-municode -static -static-libgcc -Bstatic -lpthread
+WIN_FLAGS=-municode -static -static-libgcc -Bstatic
WIN_SRC=main.c win32_utils.c
default: main.exe
{
pkgs,
overrideCC,
...
}:
let
useWin32ThreadModel =
stdenv:
overrideCC stdenv (
stdenv.cc.override (old: {
cc = old.cc.override {
threadsCross = {
model = "win32";
package = null;
};
};
})
);
in
(useWin32ThreadModel pkgs.pkgsCross.mingwW64.stdenv).mkDerivation {
pname = "steam-redirector";
version = "5.0.3";
src = pkgs.fetchFromGitHub {
owner = "rockerbacon";
repo = "modorganizer2-linux-installer";
rev = "90d33013aca0deceaadc099be4d682e08f237ef5";
sha256 = "sha256-RYN5/t5Hmzu+Tol9iJ+xDmLGY9sAkLTU0zY6UduJ4i0=";
};
patches = [ ./fix.patch ];
buildPhase = ''
cd steam-redirector/
make "main.exe"
'';
installPhase = ''
install -Dm0755 main.exe $out/main.exe
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment