python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / games / sgt-puzzles / default.nix
blob752181581f3886a487150a9bc9c78696954567b9
1 { lib, stdenv, fetchurl, desktop-file-utils
2 , gtk3, libX11, cmake, imagemagick
3 , pkg-config, perl, wrapGAppsHook
4 , isMobile ? false
5 }:
7 stdenv.mkDerivation rec {
8   pname = "sgt-puzzles";
9   version = "20220913.27dd36e";
11   src = fetchurl {
12     url = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${version}.tar.gz";
13     hash = "sha256-fj1XWuXcW01uuC5dK2wDIrweyruSRdfEZBfmEj99zZE=";
14   };
16   sgt-puzzles-menu = fetchurl {
17     url = "https://raw.githubusercontent.com/gentoo/gentoo/720e614d0107e86fc1e520bac17726578186843d/games-puzzle/sgt-puzzles/files/sgt-puzzles.menu";
18     sha256 = "088w0x9g3j8pn725ix8ny8knhdsfgjr3hpswsh9fvfkz5vlg2xkm";
19   };
21   nativeBuildInputs = [
22     cmake
23     desktop-file-utils
24     imagemagick
25     perl
26     pkg-config
27     wrapGAppsHook
28   ];
30   NIX_CFLAGS_COMPILE = if isMobile then "-DSTYLUS_BASED" else "";
32   buildInputs = [ gtk3 libX11 ];
34   postInstall = ''
35     for i in  $(basename -s $out/bin/*); do
37       ln -s $out/bin/$i $out/bin/sgt-puzzle-$i
38       install -Dm644 icons/$i-96d24.png -t $out/share/icons/hicolor/96x96/apps/
40       # Generate/validate/install .desktop files.
41       echo "[Desktop Entry]" > $i.desktop
42       desktop-file-install --dir $out/share/applications \
43         --set-key Type --set-value Application \
44         --set-key Exec --set-value $i \
45         --set-key Name --set-value $i \
46         --set-key Comment --set-value "${meta.description}" \
47         --set-key Categories --set-value "Game;LogicGame;X-sgt-puzzles;" \
48         --set-key Icon --set-value $out/share/icons/hicolor/96x96/apps/$i-96d24.png \
49         $i.desktop
50     done
52     echo "[Desktop Entry]" > sgt-puzzles.directory
53     desktop-file-install --dir $out/share/desktop-directories \
54       --set-key Type --set-value Directory \
55       --set-key Name --set-value Puzzles \
56       --set-key Icon --set-value $out/share/icons/hicolor/48x48/apps/sgt-puzzles_map \
57       sgt-puzzles.directory
59     install -Dm644 ${sgt-puzzles-menu} -t $out/etc/xdg/menus/applications-merged/
60   '';
62   meta = with lib; {
63     description = "Simon Tatham's portable puzzle collection";
64     license = licenses.mit;
65     maintainers = with maintainers; [ raskin tomfitzhenry ];
66     platforms = platforms.linux;
67     homepage = "https://www.chiark.greenend.org.uk/~sgtatham/puzzles/";
68   };