65 lines
1.5 KiB
Nix
65 lines
1.5 KiB
Nix
{ pkgs, ... }:
|
|
|
|
let
|
|
# Fix home dir
|
|
gameDir = "/home/malte/games";
|
|
notify = "${pkgs.libnotify}/bin/notify-send";
|
|
|
|
sanityCheck = name: dir: ''
|
|
if [[ ! -d "${gameDir}/${dir}" ]]; then
|
|
${notify} -a System "Not installed" "${name} is not installed"
|
|
exit 1
|
|
fi
|
|
'';
|
|
|
|
mkScript =
|
|
{ gameName, scriptName, dir ? gameName, preExec ? "", start ? "start.sh" }:
|
|
pkgs.writeScriptBin scriptName ''
|
|
#!${pkgs.stdenv.shell}
|
|
if [[ ! -d "${gameDir}/${dir}" ]]; then
|
|
${notify} -a System "Not installed" "${gameName} is not installed"
|
|
exit 1
|
|
fi
|
|
cd "${gameDir}/${dir}"
|
|
${preExec}
|
|
exec ${pkgs.steam-run-native}/bin/steam-run ./${start}
|
|
'';
|
|
|
|
games = [
|
|
{
|
|
gameName = "Dead Cells";
|
|
scriptName = "dead-cells";
|
|
dir = "./Dead Cells/game";
|
|
preExec = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.";
|
|
start = "deadcells";
|
|
}
|
|
{
|
|
gameName = "Stellaris";
|
|
scriptName = "stellaris";
|
|
dir = "./Stellaris/game";
|
|
start = "stellaris";
|
|
}
|
|
{
|
|
gameName = "Thimbleweed Park";
|
|
scriptName = "thimbleweed-park";
|
|
dir = "./Thimbleweed Park/game";
|
|
start = "ThimbleweedPark";
|
|
}
|
|
{
|
|
gameName = "Into the Breach";
|
|
scriptName = "into-the-breach";
|
|
}
|
|
{
|
|
gameName = "FTL Advanced Edition";
|
|
scriptName = "ftl-advanced-edition";
|
|
}
|
|
];
|
|
|
|
in {
|
|
home.packages = [
|
|
# Necessary packages
|
|
#pkgs.steam-run-native
|
|
pkgs.libnotify
|
|
] ++ map mkScript games;
|
|
}
|