{ pkgs ? import {}, fetchgog }: let desktopItem = pkgs.makeDesktopItem { desktopName = "stronghold-crusader"; name = "stronghold-crusader"; exec = "@out@/bin/stronghold_crusader"; icon = "stronghold-crusader"; terminal = "False"; type = "Application"; categories = "Game;StrategyGame"; genericName = "Stronghold Crusader"; }; desktopItemExtreme = pkgs.makeDesktopItem { desktopName = "stronghold-crusader-extreme"; name = "stronghold-crusader-extreme"; exec = "@out@/bin/stronghold_crusader_extreme"; icon = "stronghold-crusader-extreme"; terminal = "False"; type = "Application"; categories = "Game;StrategyGame"; genericName = "Stronghold Crusader Extreme"; }; in pkgs.stdenv.mkDerivation rec { pname = "stronghold-crusaders"; pversion = "1.41"; name = "${pname}-${pversion}"; src = fetchgog { name = "setup_${name}.exe"; sha256 = "dbf5a71d99fff24ee19232b2c7e1f1e6cf6232db46fa53d6d22aae0050ca9915"; fileid = "stronghold_crusader/en1installer0"; }; nativeBuildInputs = with pkgs; [ icoutils innoextract ]; buildInputs = with pkgs; [ bash wine ]; unpackPhase = '' mkdir -p $out/share/stronghold-crusader cd $out/share/stronghold-crusader innoextract $src mkdir -p $out/share/icons wrestool -x -t 14 Stronghold\ Crusader.exe > $out/share/icons/stronghold-crusader.ico wrestool -x -t 14 Stronghold_Crusader_Extreme.exe > $out/share/icons/stronghold-crusader-extreme.ico rm -rf tmp ''; installPhase = '' mkdir -p $out/bin mkdir -p $out/share/applications/ cat << EOF > $out/bin/stronghold_crusader #!${pkgs.bash}/bin/bash cd $out/share/stronghold-crusader ${pkgs.wine}/bin/wine Stronghold\ Crusader.exe EOF chmod +x $out/bin/stronghold_crusader install -Dm755 ${desktopItem}/share/applications/stronghold-crusader.desktop $out/share/applications/stronghold-crusader.desktop cat << EOF > $out/bin/stronghold_crusader_extreme #!${pkgs.bash}/bin/bash cd $out/share/stronghold-crusader ${pkgs.wine}/bin/wine Stronghold_Crusader_Extreme.exe EOF chmod +x $out/bin/stronghold_crusader_extreme install -Dm755 ${desktopItemExtreme}/share/applications/stronghold-crusader-extreme.desktop $out/share/applications/stronghold-crusader-extreme.desktop ''; meta = with pkgs.stdenv.lib; { description = "A realtime strategy game."; homepage = https://www.gog.com/game/stronghold_crusader; license = licenses.unfree; maintainers = [{ email = "jakob-nixos@truh.at"; github = "truh"; name = "Jakob Klepp"; }]; platforms = platforms.linux; }; }