mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
starsector: generate desktop file
This commit is contained in:
parent
ac96a27f7a
commit
8c4233de8a
@ -6,6 +6,8 @@
|
|||||||
, openjdk
|
, openjdk
|
||||||
, stdenv
|
, stdenv
|
||||||
, xorg
|
, xorg
|
||||||
|
, copyDesktopItems
|
||||||
|
, makeDesktopItem
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
@ -17,7 +19,10 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "sha256-/5ij/079aOad7otXSFFcmVmiYQnMX/0RXGOr1j0rkGY=";
|
sha256 = "sha256-/5ij/079aOad7otXSFFcmVmiYQnMX/0RXGOr1j0rkGY=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [
|
||||||
|
copyDesktopItems
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
buildInputs = with xorg; [
|
buildInputs = with xorg; [
|
||||||
alsa-lib
|
alsa-lib
|
||||||
libXxf86vm
|
libXxf86vm
|
||||||
@ -25,18 +30,37 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
|
desktopItems = [
|
||||||
|
(makeDesktopItem {
|
||||||
|
name = "starsector";
|
||||||
|
exec = "starsector";
|
||||||
|
icon = "starsector";
|
||||||
|
comment = meta.description;
|
||||||
|
genericName = "starsector";
|
||||||
|
desktopName = "Starsector";
|
||||||
|
categories = "Game;";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
# need to cd into $out in order for classpath to pick up correct jar files
|
# need to cd into $out in order for classpath to pick up correct jar files
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
rm -r jre_linux # remove jre7
|
rm -r jre_linux # remove jre7
|
||||||
rm starfarer.api.zip
|
rm starfarer.api.zip
|
||||||
cp -r ./* $out
|
cp -r ./* $out
|
||||||
|
|
||||||
|
mkdir -p $out/share/icons/hicolor/64x64/apps
|
||||||
|
ln -s $out/graphics/ui/s_icon64.png $out/share/icons/hicolor/64x64/apps/starsector.png
|
||||||
|
|
||||||
wrapProgram $out/starsector.sh \
|
wrapProgram $out/starsector.sh \
|
||||||
--prefix PATH : ${lib.makeBinPath [ openjdk ]} \
|
--prefix PATH : ${lib.makeBinPath [ openjdk ]} \
|
||||||
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \
|
||||||
--run "mkdir -p \$XDG_DATA_HOME/starsector; cd $out"
|
--run 'mkdir -p ''${XDG_DATA_HOME:-~/.local/share}/starsector; cd '"$out"
|
||||||
ln -s $out/starsector.sh $out/bin/starsector
|
ln -s $out/starsector.sh $out/bin/starsector
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# it tries to run everything with relative paths, which makes it CWD dependent
|
# it tries to run everything with relative paths, which makes it CWD dependent
|
||||||
@ -44,8 +68,7 @@ stdenv.mkDerivation rec {
|
|||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace starsector.sh \
|
substituteInPlace starsector.sh \
|
||||||
--replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
|
--replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
|
||||||
--replace "./native/linux" "$out/native/linux" \
|
--replace "./native/linux" "$out/native/linux"
|
||||||
--replace "./" "\$XDG_DATA_HOME/starsector/"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Loading…
Reference in New Issue
Block a user