base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / de / desktop-postflop / package.nix
blob0eb643a44b041f662a3e06cbe64bb5b123391953
1 { lib
2 , rustPlatform
3 , buildNpmPackage
4 , fetchFromGitHub
5 , copyDesktopItems
6 , makeDesktopItem
7 , pkg-config
8 , gtk3
9 , libsoup
10 , webkitgtk_4_0
13 rustPlatform.buildRustPackage rec {
14   pname = "desktop-postflop";
15   version = "0.2.7";
17   src = fetchFromGitHub {
18     owner = "b-inary";
19     repo = "desktop-postflop";
20     rev = "v${version}";
21     hash = "sha256-pOPxNHM4mseIuyyWNoU0l+dGvfURH0+9+rmzRIF0I5s=";
22   };
24   npmDist = buildNpmPackage {
25     name = "${pname}-${version}-dist";
26     inherit src;
28     npmDepsHash = "sha256-HWZLicyKL2FHDjZQj9/CRwVi+uc/jHmVNxtlDuclf7s=";
30     installPhase = ''
31       mkdir -p $out
32       cp -r dist/* $out
33     '';
34   };
36   sourceRoot = "${src.name}/src-tauri";
38   cargoLock = {
39     lockFile = ./Cargo.lock;
40     outputHashes = {
41       "postflop-solver-0.1.0" = "sha256-coEl09eMbQqSos1sqWLnfXfhujSTsnVnOlOQ+JbdFWY=";
42     };
43   };
45   postPatch = ''
46     substituteInPlace tauri.conf.json \
47         --replace "../dist" "${npmDist}"
48   '';
50   # postflop-solver requires unstable rust features
51   env.RUSTC_BOOTSTRAP = 1;
53   nativeBuildInputs = [
54     copyDesktopItems
55     pkg-config
56   ];
58   buildInputs = [
59     gtk3
60     libsoup
61     webkitgtk_4_0
62   ];
64   postInstall = ''
65     install -Dm644 ${src}/public/favicon.png $out/share/icons/hicolor/128x128/apps/desktop-postflop.png
66   '';
68   desktopItems = [
69     (makeDesktopItem {
70       name = "desktop-postflop";
71       exec = "desktop-postflop";
72       icon = "desktop-postflop";
73       desktopName = "Desktop Postflop";
74       comment = meta.description;
75       categories = [ "Utility" ];
76       terminal = false;
77     })
78   ];
80   meta = {
81     changelog = "https://github.com/b-inary/desktop-postflop/releases/tag/${src.rev}";
82     description = "Free, open-source GTO solver for Texas hold'em poker";
83     homepage = "https://github.com/b-inary/desktop-postflop";
84     license = lib.licenses.agpl3Plus;
85     mainProgram = "desktop-postflop";
86     maintainers = with lib.maintainers; [ tomasajt ];
87   };