summaryrefslogtreecommitdiff
path: root/pkgs/by-name/lu/ludusavi/package.nix
blob: fa5a42cbe05f542839a5363337d65b045addbda2 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  installShellFiles,
  cmake,
  pkg-config,
  makeWrapper,
  wrapGAppsHook3,
  bzip2,
  fontconfig,
  freetype,
  libGL,
  libX11,
  libXcursor,
  libXrandr,
  libXi,
  libxkbcommon,
  vulkan-loader,
  wayland,
  zenity,
  libsForQt5,
  cairo,
  pango,
  atkmm,
  gdk-pixbuf,
  dbus-glib,
  gtk3,
  glib,
}:

rustPlatform.buildRustPackage rec {
  pname = "ludusavi";
  version = "0.29.1";

  src = fetchFromGitHub {
    owner = "mtkennerly";
    repo = "ludusavi";
    rev = "v${version}";
    hash = "sha256-IApPudo8oD6YkYJkGpowqpaqrsl2/Q2VFyYfYQI3mN0=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-ixxUz+XJPzPu51sxHpXs92Tis2gj9SElqYtNiN+n2EY=";

  dontWrapGApps = true;

  nativeBuildInputs = [
    cmake
    installShellFiles
    pkg-config
    makeWrapper
    wrapGAppsHook3
  ];

  buildInputs = [
    fontconfig
    freetype
    libX11
    libXcursor
    libXrandr
    libXi
    cairo
    pango
    atkmm
    gdk-pixbuf
    gtk3
  ];

  postInstall =
    ''
      install -Dm644 assets/linux/com.mtkennerly.ludusavi.metainfo.xml -t \
        "$out/share/metainfo/"
      install -Dm644 assets/icon.png \
        "$out/share/icons/hicolor/64x64/apps/com.mtkennerly.ludusavi.png"
      install -Dm644 assets/icon.svg \
        "$out/share/icons/hicolor/scalable/apps/com.mtkennerly.ludusavi.svg"
      install -Dm644 "assets/linux/com.mtkennerly.ludusavi.desktop" -t "$out/share/applications/"
      install -Dm644 assets/MaterialIcons-Regular.ttf -t "$out/share/fonts/TTF/"
      install -Dm644 LICENSE -t "$out/share/licenses/ludusavi/"
    ''
    + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
      installShellCompletion --cmd ludusavi \
        --bash <($out/bin/ludusavi complete bash) \
        --fish <($out/bin/ludusavi complete fish) \
        --zsh <($out/bin/ludusavi complete zsh)
    '';

  postFixup =
    let
      libPath = lib.makeLibraryPath [
        libGL
        bzip2
        fontconfig
        freetype
        libX11
        libXcursor
        libXrandr
        libXi
        libxkbcommon
        vulkan-loader
        wayland
        gtk3
        dbus-glib
        glib
      ];
    in
    ''
      patchelf --set-rpath "${libPath}" "$out/bin/ludusavi"
      wrapProgram $out/bin/ludusavi --prefix PATH : ${
        lib.makeBinPath [
          zenity
          libsForQt5.kdialog
        ]
      } \
        "''${gappsWrapperArgs[@]}"
    '';

  meta = with lib; {
    description = "Backup tool for PC game saves";
    homepage = "https://github.com/mtkennerly/ludusavi";
    changelog = "https://github.com/mtkennerly/ludusavi/blob/v${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [
      pasqui23
      megheaiulian
    ];
    mainProgram = "ludusavi";
  };
}