67 lines
1.9 KiB
Nix
67 lines
1.9 KiB
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
let
|
|
|
|
_basename = "stronghold-crusader";
|
|
_version = "1.41_20410";
|
|
|
|
setup_exe = pkgs.requireFile rec {
|
|
name = "setup_stronghold_crusader_extreme_hd_${_version}.exe";
|
|
message = "Please download ${name} from https://gog.com/.";
|
|
sha256 = "05crr9801biasbb57yj6vcr65kz6y7hwgcijjbhlxwpzk4fsgxfv";
|
|
};
|
|
|
|
game_extracted = pkgs.stdenv.mkDerivation rec {
|
|
name = "${_basename}-extracted-${_version}";
|
|
version = _version;
|
|
|
|
src = setup_exe;
|
|
|
|
nativeBuildInputs = with pkgs; [ innoextract ];
|
|
|
|
unpackPhase = ''
|
|
innoextract --gog --extract $src
|
|
'';
|
|
|
|
buildPhase = ":";
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/share/${_basename}
|
|
cp -R . $out/share/${_basename}/
|
|
'';
|
|
};
|
|
|
|
game_wrapped = pkgs.stdenv.mkDerivation rec {
|
|
name = "${_basename}-wrapped-${_version}";
|
|
version = _version;
|
|
buildInputs = with pkgs; [ game_extracted wine icoutils ];
|
|
|
|
unpackPhase = ''
|
|
wrestool -x -t 14 "${game_extracted}/share/${_basename}/Stronghold Crusader.exe" > stronghold_crusader.ico
|
|
wrestool -x -t 14 "${game_extracted}/share/${_basename}/Stronghold_Crusader_Extreme.exe" > stronghold_crusader_extreme.ico
|
|
'';
|
|
|
|
buildPhase = ":";
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
mkdir -p $out/share/icons/hicolor/{32x32,256x256}/apps
|
|
|
|
cp 'stronghold_crusader.ico' $out/share/icons/hicolor/256x256/apps/
|
|
cp 'stronghold_crusader_extreme.ico' $out/share/icons/hicolor/32x32/apps/
|
|
|
|
cat << EOF > $out/bin/stronghold_crusader
|
|
#!${pkgs.bash}/bin/bash
|
|
${pkgs.wine}/bin/wine "${game_extracted}/share/${_basename}/Stronghold Crusader.exe"
|
|
EOF
|
|
chmod +x $out/bin/stronghold_crusader
|
|
|
|
cat << EOF > $out/bin/stronghold_crusader_extreme
|
|
#!${pkgs.bash}/bin/bash
|
|
${pkgs.wine}/bin/wine "${game_extracted}/share/${_basename}/Stronghold_Crusader_Extreme.exe"
|
|
EOF
|
|
chmod +x $out/bin/stronghold_crusader_extreme
|
|
'';
|
|
};
|
|
|
|
in game_wrapped
|