mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-18 02:05:51 +03:00
starsector: generate desktop file
This commit is contained in:
parent
ac96a27f7a
commit
8c4233de8a
@ -6,6 +6,8 @@
|
||||
, openjdk
|
||||
, stdenv
|
||||
, xorg
|
||||
, copyDesktopItems
|
||||
, makeDesktopItem
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -17,7 +19,10 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "sha256-/5ij/079aOad7otXSFFcmVmiYQnMX/0RXGOr1j0rkGY=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
nativeBuildInputs = [
|
||||
copyDesktopItems
|
||||
makeWrapper
|
||||
];
|
||||
buildInputs = with xorg; [
|
||||
alsa-lib
|
||||
libXxf86vm
|
||||
@ -25,18 +30,37 @@ stdenv.mkDerivation rec {
|
||||
|
||||
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
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
rm -r jre_linux # remove jre7
|
||||
rm starfarer.api.zip
|
||||
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 \
|
||||
--prefix PATH : ${lib.makeBinPath [ openjdk ]} \
|
||||
--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
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# it tries to run everything with relative paths, which makes it CWD dependent
|
||||
@ -44,8 +68,7 @@ stdenv.mkDerivation rec {
|
||||
postPatch = ''
|
||||
substituteInPlace starsector.sh \
|
||||
--replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
|
||||
--replace "./native/linux" "$out/native/linux" \
|
||||
--replace "./" "\$XDG_DATA_HOME/starsector/"
|
||||
--replace "./native/linux" "$out/native/linux"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
|
Loading…
Reference in New Issue
Block a user