Files
unciv/unciv.nix
2022-08-30 18:19:52 +00:00

36 lines
914 B
Nix

# nix-build unciv.rix
{ pkgs ? import <nixpkgs> { }, stateDir ? "/var/lib/unciv" }:
let
jarFile = pkgs.fetchurl {
url = "https://github.com/yairm210/Unciv/releases/4.2.6/download/UncivServer.jar";
sha256 = "sha256-gGZCMG8+mqXK/2JgEN7ONBJ8QR7lAfl843EGB2j+N/E=";
};
uncivServerCmd = pkgs.writeShellScriptBin "UncivServer.sh" ''
${pkgs.jre}/bin/java -jar ${jarFile} "$@"
'';
in
{
packages = uncivServerCmd;
systemd.services.unciv = {
serviceConfig.Type = "oneshot";
script = ''
mkdir -p "${stateDir}"
${uncivServerCmd}/bin/UncivServer.sh -f "${stateDir}"
'';
};
meta = {
description = "The multiplayer server for Unciv - An open-source, mod-friendly Android+Desktop remake of Civ V.";
homepage = https://yairm210.itch.io/unciv;
maintainers = "stubbfel";
license = pkgs.lib.licenses.mpl2;
platforms = pkgs.lib.platforms.unix;
};
}