diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2018-07-05 00:10:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-05 00:10:13 -0400 |
commit | a4c9492217b5b7f14b4c8015e782cf4d12acadc4 (patch) | |
tree | 434b08ee8c585fc71c93b5d452538acce77ffee7 /pkgs/games/dwarf-fortress | |
parent | 3026a778bac837ec7f3c2c9b958cbbcd0f84fafd (diff) | |
parent | 472d8dcb9159110a61a7ebd0cace826900ca6b3c (diff) |
Merge pull request #43057 from Baughn/nix-df
dwarf-fortress: Run legends-browser with a suitable working directory
Diffstat (limited to 'pkgs/games/dwarf-fortress')
-rw-r--r-- | pkgs/games/dwarf-fortress/legends-browser/default.nix | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/pkgs/games/dwarf-fortress/legends-browser/default.nix b/pkgs/games/dwarf-fortress/legends-browser/default.nix index 06a40bb85c9e9..3bc4fa9c4bb58 100644 --- a/pkgs/games/dwarf-fortress/legends-browser/default.nix +++ b/pkgs/games/dwarf-fortress/legends-browser/default.nix @@ -1,24 +1,32 @@ -{ stdenv, fetchurl, jre }: +{ stdenvNoCC, buildEnv, writeShellScriptBin, fetchurl, jre }: -stdenv.mkDerivation rec { +let name = "legends-browser-${version}"; version = "1.17.1"; - src = fetchurl { + jar = fetchurl { url = "https://github.com/robertjanetzko/LegendsBrowser/releases/download/${version}/legendsbrowser-${version}.jar"; sha256 = "05b4ksbl4481rh3ykfirbp6wvxhppcd5mvclhn9995gsrcaj8gx9"; }; - - unpackPhase = "true"; - - installPhase = '' - mkdir -p $out/bin - ln -s $src $out/legends-browser.jar - echo "${jre}/bin/java -jar $out/legends-browser.jar" > $out/bin/legends-browser - chmod a+x $out/bin/legends-browser + + script = writeShellScriptBin "legends-browser" '' + set -eu + BASE="$HOME/.local/share/df_linux/legends-browser/" + mkdir -p "$BASE" + cd "$BASE" + if [[ ! -e legendsbrowser.properties ]]; then + echo 'Creating initial configuration for legends-browser' + echo "last=$(cd ..; pwd)" > legendsbrowser.properties + fi + ${jre}/bin/java -jar ${jar} ''; +in + +buildEnv { + inherit name; + paths = [ script ]; - meta = with stdenv.lib; { + meta = with stdenvNoCC.lib; { description = "A multi-platform, open source, java-based legends viewer for dwarf fortress"; maintainers = with maintainers; [ Baughn ]; license = licenses.mit; |