19 stdenv.mkDerivation rec {
20 pname = "sgt-puzzles";
21 version = "20241230.79be403";
24 url = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${version}.tar.gz";
25 hash = "sha256-gWt328Ic0+ctcptnhnTprAEmMpcpfAAyTEqRuKF0gVY=";
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";
40 halibut # For help pages
43 env.NIX_CFLAGS_COMPILE = lib.optionalString isMobile "-DSTYLUS_BASED";
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 \
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 \
75 install -Dm644 ${sgt-puzzles-menu} -t $out/etc/xdg/menus/applications-merged/
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
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"
92 description = "Simon Tatham's portable puzzle collection";
93 license = licenses.mit;
94 maintainers = with maintainers; [
98 platforms = platforms.linux;
99 homepage = "https://www.chiark.greenend.org.uk/~sgtatham/puzzles/";