1 { lib, stdenv, fetchurl, desktop-file-utils
2 , gtk3, libX11, cmake, imagemagick
3 , pkg-config, perl, wrapGAppsHook3, nixosTests, writeScript
7 stdenv.mkDerivation rec {
9 version = "20240330.fd304c5";
12 url = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${version}.tar.gz";
13 hash = "sha256-usEgCfbeKOkAg/sHpRxuMcPGHxb+J5+r92aO4Ar7iUA=";
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";
30 env.NIX_CFLAGS_COMPILE = lib.optionalString isMobile "-DSTYLUS_BASED";
32 buildInputs = [ gtk3 libX11 ];
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 \
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 \
59 install -Dm644 ${sgt-puzzles-menu} -t $out/etc/xdg/menus/applications-merged/
63 tests.sgt-puzzles = nixosTests.sgt-puzzles;
64 updateScript = writeScript "update-sgt-puzzles" ''
65 #!/usr/bin/env nix-shell
66 #!nix-shell -i bash -p curl pcre common-updater-scripts
70 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')"
71 update-source-version sgt-puzzles "$version"
76 description = "Simon Tatham's portable puzzle collection";
77 license = licenses.mit;
78 maintainers = with maintainers; [ raskin tomfitzhenry ];
79 platforms = platforms.linux;
80 homepage = "https://www.chiark.greenend.org.uk/~sgtatham/puzzles/";