Skip to content

Commit 6dbeed2

Browse files
committed
factorio: add .desktop file
1 parent cab546b commit 6dbeed2

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

pkgs/games/factorio/default.nix

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ stdenv, fetchurl, makeWrapper
1+
{ stdenv, fetchurl, makeWrapper, makeDesktopItem
22
, alsaLib, libpulseaudio, libX11, libXcursor, libXinerama, libXrandr, libXi, libGL
33
, libSM, libICE, libXext, factorio-utils
44
, releaseType
@@ -45,6 +45,16 @@ let
4545
Note the ultimate "_" is replaced with "-" in the --name arg!
4646
'';
4747

48+
desktopItem = makeDesktopItem {
49+
name = "factorio";
50+
desktopName = "Factorio";
51+
comment = "A game in which you build and maintain factories.";
52+
exec = "factorio";
53+
icon = "factorio";
54+
type = "Application";
55+
categories = "Game";
56+
};
57+
4858
branch = if experimental then "experimental" else "stable";
4959

5060
# NB `experimental` directs us to take the latest build, regardless of its branch;
@@ -148,6 +158,11 @@ let
148158
patchelf \
149159
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
150160
$out/bin/factorio
161+
162+
mkdir -p $out/share/icons/hicolor/{64x64,128x128}/apps
163+
cp -a data/core/graphics/factorio-icon.png $out/share/icons/hicolor/64x64/apps/factorio.png
164+
cp -a data/core/graphics/factorio-icon@2x.png $out/share/icons/hicolor/128x128/apps/factorio.png
165+
ln -s ${desktopItem}/share/applications $out/share/
151166
'';
152167

153168
meta = {

0 commit comments

Comments
 (0)