2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchurl, desktop-file-utils
|
2022-07-18 12:20:28 +00:00
|
|
|
, gtk3, libX11, cmake, imagemagick
|
2023-10-02 13:12:24 +00:00
|
|
|
, pkg-config, perl, wrapGAppsHook, nixosTests, writeScript
|
2022-08-07 07:28:25 +00:00
|
|
|
, isMobile ? false
|
2017-05-11 06:52:43 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-06-22 21:44:58 +00:00
|
|
|
pname = "sgt-puzzles";
|
2023-09-29 13:54:01 +00:00
|
|
|
version = "20230918.2d9e414";
|
2017-05-11 06:52:43 +00:00
|
|
|
|
2016-04-20 09:33:35 +00:00
|
|
|
src = fetchurl {
|
2020-03-01 22:58:28 +00:00
|
|
|
url = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${version}.tar.gz";
|
2023-09-29 13:54:01 +00:00
|
|
|
hash = "sha256-YsvJ/5DTevRb+sCxWc/KcD2X5IXwAXvWGVfokr06nUM=";
|
2015-07-05 08:57:38 +00:00
|
|
|
};
|
2017-05-11 06:52:43 +00:00
|
|
|
|
2020-03-02 03:13:48 +00:00
|
|
|
sgt-puzzles-menu = fetchurl {
|
2022-07-18 12:40:13 +00:00
|
|
|
url = "https://raw.githubusercontent.com/gentoo/gentoo/720e614d0107e86fc1e520bac17726578186843d/games-puzzle/sgt-puzzles/files/sgt-puzzles.menu";
|
2020-03-02 03:13:48 +00:00
|
|
|
sha256 = "088w0x9g3j8pn725ix8ny8knhdsfgjr3hpswsh9fvfkz5vlg2xkm";
|
|
|
|
};
|
|
|
|
|
2022-07-18 12:20:28 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
desktop-file-utils
|
|
|
|
imagemagick
|
|
|
|
perl
|
|
|
|
pkg-config
|
|
|
|
wrapGAppsHook
|
|
|
|
];
|
2017-05-11 06:52:43 +00:00
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString isMobile "-DSTYLUS_BASED";
|
2022-08-07 07:28:25 +00:00
|
|
|
|
2017-05-11 06:52:43 +00:00
|
|
|
buildInputs = [ gtk3 libX11 ];
|
|
|
|
|
2016-05-20 09:21:38 +00:00
|
|
|
postInstall = ''
|
2020-03-02 03:13:48 +00:00
|
|
|
for i in $(basename -s $out/bin/*); do
|
|
|
|
|
|
|
|
ln -s $out/bin/$i $out/bin/sgt-puzzle-$i
|
2022-07-18 12:24:40 +00:00
|
|
|
install -Dm644 icons/$i-96d24.png -t $out/share/icons/hicolor/96x96/apps/
|
2020-03-02 03:13:48 +00:00
|
|
|
|
|
|
|
# Generate/validate/install .desktop files.
|
|
|
|
echo "[Desktop Entry]" > $i.desktop
|
|
|
|
desktop-file-install --dir $out/share/applications \
|
|
|
|
--set-key Type --set-value Application \
|
|
|
|
--set-key Exec --set-value $i \
|
|
|
|
--set-key Name --set-value $i \
|
|
|
|
--set-key Comment --set-value "${meta.description}" \
|
|
|
|
--set-key Categories --set-value "Game;LogicGame;X-sgt-puzzles;" \
|
2022-07-18 12:24:40 +00:00
|
|
|
--set-key Icon --set-value $out/share/icons/hicolor/96x96/apps/$i-96d24.png \
|
2020-03-02 03:13:48 +00:00
|
|
|
$i.desktop
|
|
|
|
done
|
2020-03-01 22:58:28 +00:00
|
|
|
|
2020-03-02 03:13:48 +00:00
|
|
|
echo "[Desktop Entry]" > sgt-puzzles.directory
|
|
|
|
desktop-file-install --dir $out/share/desktop-directories \
|
|
|
|
--set-key Type --set-value Directory \
|
|
|
|
--set-key Name --set-value Puzzles \
|
|
|
|
--set-key Icon --set-value $out/share/icons/hicolor/48x48/apps/sgt-puzzles_map \
|
|
|
|
sgt-puzzles.directory
|
2020-03-01 22:58:28 +00:00
|
|
|
|
2020-03-02 03:13:48 +00:00
|
|
|
install -Dm644 ${sgt-puzzles-menu} -t $out/etc/xdg/menus/applications-merged/
|
2016-05-20 09:21:38 +00:00
|
|
|
'';
|
2020-03-01 22:58:28 +00:00
|
|
|
|
2023-10-02 13:12:24 +00:00
|
|
|
passthru = {
|
|
|
|
tests.sgtpuzzles = nixosTests.sgtpuzzles;
|
|
|
|
updateScript = writeScript "update-sgtpuzzles" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl pcre common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
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')"
|
|
|
|
update-source-version sgtpuzzles "$version"
|
|
|
|
'';
|
|
|
|
};
|
2022-11-26 07:59:13 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2008-12-15 11:55:53 +00:00
|
|
|
description = "Simon Tatham's portable puzzle collection";
|
2017-05-11 06:52:43 +00:00
|
|
|
license = licenses.mit;
|
2022-07-18 12:47:58 +00:00
|
|
|
maintainers = with maintainers; [ raskin tomfitzhenry ];
|
2017-05-11 06:52:43 +00:00
|
|
|
platforms = platforms.linux;
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.chiark.greenend.org.uk/~sgtatham/puzzles/";
|
2008-12-15 11:55:53 +00:00
|
|
|
};
|
|
|
|
}
|