pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / games / pysolfc / default.nix
blob8d63aaed948841cf5d273a0631a70eef8bce4e53
2   lib,
3   stdenv,
4   fetchzip,
5   python311Packages,
6   desktop-file-utils,
7   freecell-solver,
8   black-hole-solver,
9   _experimental-update-script-combinators,
10   gitUpdater,
13 python311Packages.buildPythonApplication rec {
14   pname = "pysolfc";
15   version = "3.0.0";
17   src = fetchzip {
18     url = "mirror://sourceforge/pysolfc/PySolFC-${version}.tar.xz";
19     hash = "sha256-LPOm83K4bdzmmQskmAnSyYpz+5y9ktQAhYCkXpODYKI=";
20   };
22   cardsets = stdenv.mkDerivation rec {
23     pname = "pysol-cardsets";
24     version = "3.0";
26     src = fetchzip {
27       url = "mirror://sourceforge/pysolfc/PySolFC-Cardsets-${version}.tar.bz2";
28       hash = "sha256-UP0dQjoZJg+iSKVOrWbkLj1KCzMWws8ZBVSBLly1a/Y=";
29     };
31     installPhase = ''
32       runHook preInstall
33       cp -r $src $out
34       runHook postInstall
35     '';
36   };
38   music = stdenv.mkDerivation rec {
39     pname = "pysol-music";
40     version = "4.50";
42     src = fetchzip {
43       url = "mirror://sourceforge/pysolfc/pysol-music-${version}.tar.xz";
44       hash = "sha256-sOl5U98aIorrQHJRy34s0HHaSW8hMUE7q84FMQAj5Yg=";
45     };
47     installPhase = ''
48       runHook preInstall
49       cp -r $src $out
50       runHook postInstall
51     '';
52   };
54   propagatedBuildInputs = with python311Packages; [
55     tkinter
56     six
57     random2
58     configobj
59     pysol-cards
60     attrs
61     pycotap
62     # optional :
63     pygame
64     freecell-solver
65     black-hole-solver
66     pillow
67   ];
69   patches = [ ./pysolfc-datadir.patch ];
71   nativeBuildInputs = [ desktop-file-utils ];
72   postPatch = ''
73     desktop-file-edit --set-key Icon --set-value ${placeholder "out"}/share/icons/pysol01.png data/pysol.desktop
74     desktop-file-edit --set-key Comment --set-value "${meta.description}" data/pysol.desktop
75   '';
77   postInstall = ''
78     mkdir $out/share/PySolFC/cardsets
79     cp -r $cardsets/* $out/share/PySolFC/cardsets
80     cp -r $music/data/music $out/share/PySolFC
81   '';
83   # No tests in archive
84   doCheck = false;
86   passthru.updateScript = _experimental-update-script-combinators.sequence (
87     # Needed in order to work around requirement that only one updater with features enabled is in sequence
88     map (updater: updater.command) [
89       (gitUpdater {
90         url = "https://github.com/shlomif/PySolFC.git";
91         rev-prefix = "pysolfc-";
92       })
93       (gitUpdater {
94         url = "https://github.com/shlomif/PySolFC-CardSets.git";
95         attrPath = "pysolfc.cardsets";
96       })
97       (gitUpdater {
98         url = "https://github.com/shlomif/pysol-music.git";
99         attrPath = "pysolfc.music";
100       })
101     ]
102   );
104   meta = with lib; {
105     description = "A collection of more than 1000 solitaire card games";
106     mainProgram = "pysol.py";
107     homepage = "https://pysolfc.sourceforge.io";
108     license = licenses.gpl3;
109     maintainers = with maintainers; [ ];
110   };