90 lines
2.4 KiB
Nix
90 lines
2.4 KiB
Nix
{
|
||
lib,
|
||
python3Packages,
|
||
gtk4,
|
||
gobject-introspection,
|
||
wrapGAppsHook4,
|
||
}:
|
||
|
||
python3Packages.buildPythonApplication rec {
|
||
pname = "shikaku";
|
||
version = "0.1.0";
|
||
pyproject = false;
|
||
|
||
src = ./.;
|
||
|
||
nativeBuildInputs = [
|
||
gobject-introspection
|
||
wrapGAppsHook4
|
||
];
|
||
|
||
buildInputs = [
|
||
gtk4
|
||
];
|
||
|
||
dependencies = with python3Packages; [
|
||
pygobject3
|
||
];
|
||
|
||
# Pure Python — nothing to compile
|
||
dontBuild = true;
|
||
|
||
installPhase = ''
|
||
runHook preInstall
|
||
|
||
install -Dm755 shikaku.py $out/share/shikaku/shikaku.py
|
||
|
||
# Wrapper script so wrapGAppsHook4 can inject GDK/GI env vars
|
||
mkdir -p $out/bin
|
||
cat > $out/bin/shikaku << EOF
|
||
#!${python3Packages.python.interpreter}
|
||
import sys
|
||
sys.path.insert(0, "$out/share/shikaku")
|
||
import shikaku
|
||
shikaku.main()
|
||
EOF
|
||
chmod +x $out/bin/shikaku
|
||
|
||
# Desktop entry for app launchers (GNOME, KDE, etc.)
|
||
install -Dm644 /dev/stdin $out/share/applications/shikaku.desktop << EOF
|
||
[Desktop Entry]
|
||
Version=1.0
|
||
Type=Application
|
||
Name=Shikaku
|
||
Comment=Rectangle partition logic puzzle
|
||
Exec=shikaku
|
||
Icon=applications-games
|
||
Terminal=false
|
||
Categories=Game;LogicGame;BoardGame;
|
||
Keywords=puzzle;shikaku;logic;grid;rectangle;
|
||
EOF
|
||
|
||
runHook postInstall
|
||
'';
|
||
|
||
# wrapGAppsHook4 handles GDK_PIXBUF_MODULE_FILE, XDG_DATA_DIRS, GI_TYPELIB_PATH, etc.
|
||
# but it expects to wrap a binary. Point it at our wrapper script.
|
||
dontWrapGApps = false;
|
||
|
||
passthru.tests.shikaku-starts = python3Packages.pytestCheckHook;
|
||
|
||
meta = {
|
||
description = "Rectangle partition logic puzzle (Shikaku)";
|
||
longDescription = ''
|
||
Shikaku is a logic puzzle where you partition a grid into non-overlapping
|
||
rectangles. Each rectangle must contain exactly one number, and that number
|
||
equals the area of the rectangle in cells. Puzzles are procedurally generated
|
||
and guaranteed to be solvable. Supports 5×5 and 7×7 grids, with larger sizes
|
||
planned. Built with Python and GTK4; plays fully offline.
|
||
'';
|
||
homepage = "https://github.com/your-github-username/shikaku"; # TODO
|
||
# changelog = "https://github.com/your-github-username/shikaku/blob/v${version}/CHANGELOG.md";
|
||
license = lib.licenses.mit;
|
||
maintainers = with lib.maintainers; [
|
||
# your-nixpkgs-handle # TODO: add yourself to maintainers/maintainer-list.nix first
|
||
];
|
||
platforms = lib.platforms.linux;
|
||
mainProgram = "shikaku";
|
||
};
|
||
}
|