summaryrefslogtreecommitdiffstats
path: root/home-configuration/managed/mindustry/default.nix
blob: 929bca76debbacf26de6dac8ffc9182d8e039e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ pkgs, ... }:
let
  version = "159.7";
  src = pkgs.fetchurl {
    url = "https://github.com/Anuken/Mindustry/releases/download/v${version}/Mindustry.jar";
    hash = "sha256:67b2e5c7575e564b184ed11e139c01ddc140afd28b238715e7d42e81612fdfbe";
  };
  icon = pkgs.fetchurl {
    url = "https://upload.wikimedia.org/wikipedia/commons/4/4a/Mindustry_Icon.png";
    hash = "sha256:1s597ywczx5c92dnqkij6drzkpn92613fqqsc1imw7dbhf07xjml";
  };
  mindustry = pkgs.writeShellScriptBin "mindustry" ''
    export LD_LIBRARY_PATH=${pkgs.libglvnd}/lib:$LD_LIBRARY_PATH
    exec ${pkgs.jdk17}/bin/java -jar ${src} "$@"
  '';
in
{
  home.packages = [ mindustry ];
  home.file.".local/share/icons/hicolor/scalable/apps/mindustry.png".source = icon;
  xdg.desktopEntries.mindustry.comment = "Sandbox tower defense with factory automation";
  xdg.desktopEntries.mindustry.name = "Mindustry";
  xdg.desktopEntries.mindustry.genericName = "Tower defense game";
  xdg.desktopEntries.mindustry.exec = "mindustry";
  xdg.desktopEntries.mindustry.icon = "mindustry";
}