tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
starsector: generate desktop file
Bruno Bigras
4 years ago
8c4233de
ac96a27f
+27
-4
1 changed file
expand all
collapse all
unified
split
pkgs
games
starsector
default.nix
+27
-4
pkgs/games/starsector/default.nix
···
6
, openjdk
7
, stdenv
8
, xorg
0
0
9
}:
10
11
stdenv.mkDerivation rec {
···
17
sha256 = "sha256-/5ij/079aOad7otXSFFcmVmiYQnMX/0RXGOr1j0rkGY=";
18
};
19
20
-
nativeBuildInputs = [ makeWrapper ];
0
0
0
21
buildInputs = with xorg; [
22
alsa-lib
23
libXxf86vm
···
25
26
dontBuild = true;
27
0
0
0
0
0
0
0
0
0
0
0
0
28
# need to cd into $out in order for classpath to pick up correct jar files
29
installPhase = ''
0
0
30
mkdir -p $out/bin
31
rm -r jre_linux # remove jre7
32
rm starfarer.api.zip
33
cp -r ./* $out
0
0
0
34
35
wrapProgram $out/starsector.sh \
36
--prefix PATH : ${lib.makeBinPath [ openjdk ]} \
37
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \
38
-
--run "mkdir -p \$XDG_DATA_HOME/starsector; cd $out"
39
ln -s $out/starsector.sh $out/bin/starsector
0
0
40
'';
41
42
# it tries to run everything with relative paths, which makes it CWD dependent
···
44
postPatch = ''
45
substituteInPlace starsector.sh \
46
--replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
47
-
--replace "./native/linux" "$out/native/linux" \
48
-
--replace "./" "\$XDG_DATA_HOME/starsector/"
49
'';
50
51
meta = with lib; {
···
6
, openjdk
7
, stdenv
8
, xorg
9
+
, copyDesktopItems
10
+
, makeDesktopItem
11
}:
12
13
stdenv.mkDerivation rec {
···
19
sha256 = "sha256-/5ij/079aOad7otXSFFcmVmiYQnMX/0RXGOr1j0rkGY=";
20
};
21
22
+
nativeBuildInputs = [
23
+
copyDesktopItems
24
+
makeWrapper
25
+
];
26
buildInputs = with xorg; [
27
alsa-lib
28
libXxf86vm
···
30
31
dontBuild = true;
32
33
+
desktopItems = [
34
+
(makeDesktopItem {
35
+
name = "starsector";
36
+
exec = "starsector";
37
+
icon = "starsector";
38
+
comment = meta.description;
39
+
genericName = "starsector";
40
+
desktopName = "Starsector";
41
+
categories = "Game;";
42
+
})
43
+
];
44
+
45
# need to cd into $out in order for classpath to pick up correct jar files
46
installPhase = ''
47
+
runHook preInstall
48
+
49
mkdir -p $out/bin
50
rm -r jre_linux # remove jre7
51
rm starfarer.api.zip
52
cp -r ./* $out
53
+
54
+
mkdir -p $out/share/icons/hicolor/64x64/apps
55
+
ln -s $out/graphics/ui/s_icon64.png $out/share/icons/hicolor/64x64/apps/starsector.png
56
57
wrapProgram $out/starsector.sh \
58
--prefix PATH : ${lib.makeBinPath [ openjdk ]} \
59
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \
60
+
--run 'mkdir -p ''${XDG_DATA_HOME:-~/.local/share}/starsector; cd '"$out"
61
ln -s $out/starsector.sh $out/bin/starsector
62
+
63
+
runHook postInstall
64
'';
65
66
# it tries to run everything with relative paths, which makes it CWD dependent
···
68
postPatch = ''
69
substituteInPlace starsector.sh \
70
--replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
71
+
--replace "./native/linux" "$out/native/linux"
0
72
'';
73
74
meta = with lib; {