nix-gog-games/games/space-colony.nix

62 lines
1.7 KiB
Nix

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