nix-gog-games/games/stronghold.nix

70 lines
2.1 KiB
Nix

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