electron-chromedriver_33: 33.3.0 -> 33.3.1
[NixPkgs.git] / pkgs / games / sgt-puzzles / default.nix
blob257bad506f5d81438a72edf25d6cd61eefdcb87b
2   lib,
3   stdenv,
4   fetchurl,
5   desktop-file-utils,
6   gtk3,
7   libX11,
8   cmake,
9   imagemagick,
10   pkg-config,
11   perl,
12   wrapGAppsHook3,
13   nixosTests,
14   writeScript,
15   halibut,
16   isMobile ? false,
19 stdenv.mkDerivation rec {
20   pname = "sgt-puzzles";
21   version = "20241230.79be403";
23   src = fetchurl {
24     url = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${version}.tar.gz";
25     hash = "sha256-gWt328Ic0+ctcptnhnTprAEmMpcpfAAyTEqRuKF0gVY=";
26   };
28   sgt-puzzles-menu = fetchurl {
29     url = "https://raw.githubusercontent.com/gentoo/gentoo/720e614d0107e86fc1e520bac17726578186843d/games-puzzle/sgt-puzzles/files/sgt-puzzles.menu";
30     sha256 = "088w0x9g3j8pn725ix8ny8knhdsfgjr3hpswsh9fvfkz5vlg2xkm";
31   };
33   nativeBuildInputs = [
34     cmake
35     desktop-file-utils
36     imagemagick
37     perl
38     pkg-config
39     wrapGAppsHook3
40     halibut # For help pages
41   ];
43   env.NIX_CFLAGS_COMPILE = lib.optionalString isMobile "-DSTYLUS_BASED";
45   buildInputs = [
46     gtk3
47     libX11
48   ];
50   postInstall = ''
51     for i in  $(basename -s $out/bin/*); do
53       ln -s $out/bin/$i $out/bin/sgt-puzzle-$i
54       install -Dm644 icons/$i-96d24.png -t $out/share/icons/hicolor/96x96/apps/
56       # Generate/validate/install .desktop files.
57       echo "[Desktop Entry]" > $i.desktop
58       desktop-file-install --dir $out/share/applications \
59         --set-key Type --set-value Application \
60         --set-key Exec --set-value $i \
61         --set-key Name --set-value $i \
62         --set-key Comment --set-value "${meta.description}" \
63         --set-key Categories --set-value "Game;LogicGame;X-sgt-puzzles;" \
64         --set-key Icon --set-value $out/share/icons/hicolor/96x96/apps/$i-96d24.png \
65         $i.desktop
66     done
68     echo "[Desktop Entry]" > sgt-puzzles.directory
69     desktop-file-install --dir $out/share/desktop-directories \
70       --set-key Type --set-value Directory \
71       --set-key Name --set-value Puzzles \
72       --set-key Icon --set-value $out/share/icons/hicolor/48x48/apps/sgt-puzzles_map \
73       sgt-puzzles.directory
75     install -Dm644 ${sgt-puzzles-menu} -t $out/etc/xdg/menus/applications-merged/
76   '';
78   passthru = {
79     tests.sgt-puzzles = nixosTests.sgt-puzzles;
80     updateScript = writeScript "update-sgt-puzzles" ''
81       #!/usr/bin/env nix-shell
82       #!nix-shell -i bash -p curl pcre common-updater-scripts
84       set -eu -o pipefail
86       version="$(curl -sI 'https://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles.tar.gz' | grep -Fi Location: | pcregrep -o1 'puzzles-([0-9a-f.]*).tar.gz')"
87       update-source-version sgt-puzzles "$version"
88     '';
89   };
91   meta = with lib; {
92     description = "Simon Tatham's portable puzzle collection";
93     license = licenses.mit;
94     maintainers = with maintainers; [
95       raskin
96       tomfitzhenry
97     ];
98     platforms = platforms.linux;
99     homepage = "https://www.chiark.greenend.org.uk/~sgtatham/puzzles/";
100   };