nix-gog-games/games/settlers-4-gold.nix

65 lines
1.8 KiB
Nix

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