mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
Merge pull request #43057 from Baughn/nix-df
dwarf-fortress: Run legends-browser with a suitable working directory
This commit is contained in:
commit
a4c9492217
@ -1,24 +1,32 @@
|
|||||||
{ stdenv, fetchurl, jre }:
|
{ stdenvNoCC, buildEnv, writeShellScriptBin, fetchurl, jre }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
let
|
||||||
name = "legends-browser-${version}";
|
name = "legends-browser-${version}";
|
||||||
version = "1.17.1";
|
version = "1.17.1";
|
||||||
|
|
||||||
src = fetchurl {
|
jar = fetchurl {
|
||||||
url = "https://github.com/robertjanetzko/LegendsBrowser/releases/download/${version}/legendsbrowser-${version}.jar";
|
url = "https://github.com/robertjanetzko/LegendsBrowser/releases/download/${version}/legendsbrowser-${version}.jar";
|
||||||
sha256 = "05b4ksbl4481rh3ykfirbp6wvxhppcd5mvclhn9995gsrcaj8gx9";
|
sha256 = "05b4ksbl4481rh3ykfirbp6wvxhppcd5mvclhn9995gsrcaj8gx9";
|
||||||
};
|
};
|
||||||
|
|
||||||
unpackPhase = "true";
|
script = writeShellScriptBin "legends-browser" ''
|
||||||
|
set -eu
|
||||||
installPhase = ''
|
BASE="$HOME/.local/share/df_linux/legends-browser/"
|
||||||
mkdir -p $out/bin
|
mkdir -p "$BASE"
|
||||||
ln -s $src $out/legends-browser.jar
|
cd "$BASE"
|
||||||
echo "${jre}/bin/java -jar $out/legends-browser.jar" > $out/bin/legends-browser
|
if [[ ! -e legendsbrowser.properties ]]; then
|
||||||
chmod a+x $out/bin/legends-browser
|
echo 'Creating initial configuration for legends-browser'
|
||||||
|
echo "last=$(cd ..; pwd)" > legendsbrowser.properties
|
||||||
|
fi
|
||||||
|
${jre}/bin/java -jar ${jar}
|
||||||
'';
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
buildEnv {
|
||||||
|
inherit name;
|
||||||
|
paths = [ script ];
|
||||||
|
|
||||||
|
meta = with stdenvNoCC.lib; {
|
||||||
description = "A multi-platform, open source, java-based legends viewer for dwarf fortress";
|
description = "A multi-platform, open source, java-based legends viewer for dwarf fortress";
|
||||||
maintainers = with maintainers; [ Baughn ];
|
maintainers = with maintainers; [ Baughn ];
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
|
Loading…
Reference in New Issue
Block a user