nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, rustPlatform
4, fetchFromGitHub
5, makeDesktopItem
6, copyDesktopItems
7, pkg-config
8, cmake
9, fontconfig
10, glib
11, gtk3
12, freetype
13, openssl
14, xorg
15, libGL
16, withGui ? false # build GUI version
17}:
18
19rustPlatform.buildRustPackage rec {
20 pname = "rusty-psn";
21 version = "0.3.0";
22
23 src = fetchFromGitHub {
24 owner = "RainbowCookie32";
25 repo = "rusty-psn";
26 rev = "v${version}";
27 sha256 = "sha256-BsbuEsW6cQbWg8BLtEBnjoCfcUCy1xWz9u0wBa8BKtA=";
28 };
29
30 cargoSha256 = "sha256-TD5du7I6Hw1PC8s9NI19jYCXlaZMnsdVj/a0q+M8Raw=";
31
32 nativeBuildInputs = [
33 pkg-config
34 ] ++ lib.optionals withGui [
35 copyDesktopItems
36 cmake
37 ];
38
39 buildInputs = [
40 openssl
41 ] ++ lib.optionals withGui [
42 fontconfig
43 glib
44 gtk3
45 freetype
46 openssl
47 xorg.libxcb
48 xorg.libX11
49 xorg.libXcursor
50 xorg.libXrandr
51 xorg.libXi
52 xorg.libxcb
53 libGL
54 libGL.dev
55 ];
56
57 buildNoDefaultFeatures = true;
58 buildFeatures = [ (if withGui then "egui" else "cli") ];
59
60 postFixup = ''
61 patchelf --set-rpath "${lib.makeLibraryPath buildInputs}" $out/bin/rusty-psn
62 '' + lib.optionalString withGui ''
63 mv $out/bin/rusty-psn $out/bin/rusty-psn-gui
64 '';
65
66 desktopItem = lib.optionalString withGui (makeDesktopItem {
67 name = "rusty-psn";
68 desktopName = "rusty-psn";
69 exec = "rusty-psn-gui";
70 comment = "A simple tool to grab updates for PS3 games, directly from Sony's servers using their updates API.";
71 categories = [
72 "Network"
73 ];
74 keywords = [
75 "psn"
76 "ps3"
77 "sony"
78 "playstation"
79 "update"
80 ];
81 });
82 desktopItems = lib.optionals withGui [ desktopItem ];
83
84 meta = with lib; {
85 description = "Simple tool to grab updates for PS3 games, directly from Sony's servers using their updates API";
86 homepage = "https://github.com/RainbowCookie32/rusty-psn/";
87 license = licenses.mit;
88 platforms = [ "x86_64-linux" ];
89 maintainers = with maintainers; [ AngryAnt ];
90 };
91}