Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / xivlauncher / default.nix
blob0a621f625e8843ce5fe869d296e4b2254f60a706
1 { lib, buildDotnetModule, fetchFromGitHub, dotnetCorePackages, SDL2, libsecret, glib, gnutls, aria2, steam, gst_all_1
2 , copyDesktopItems, makeDesktopItem, makeWrapper
3 , useSteamRun ? true }:
5 let
6   rev = "1.0.6";
7 in
8   buildDotnetModule rec {
9     pname = "XIVLauncher";
10     version = rev;
12     src = fetchFromGitHub {
13       owner = "goatcorp";
14       repo = "XIVLauncher.Core";
15       inherit rev;
16       hash = "sha256-P1i12vw9KQOTL7QBxjKPSlda5rvoyl7DGmuuD5iVEQs=";
17       fetchSubmodules = true;
18     };
20     nativeBuildInputs = [ copyDesktopItems makeWrapper ];
22     buildInputs = with gst_all_1; [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav ];
24     projectFile = "src/XIVLauncher.Core/XIVLauncher.Core.csproj";
25     nugetDeps = ./deps.nix; # File generated with `nix-build -A xivlauncher.passthru.fetch-deps`
27     dotnetFlags = [
28       "-p:BuildHash=${rev}"
29       "-p:PublishSingleFile=false"
30     ];
32     postPatch = ''
33       substituteInPlace lib/FFXIVQuickLauncher/src/XIVLauncher.Common/Game/Patch/Acquisition/Aria/AriaHttpPatchAcquisition.cs \
34         --replace 'ariaPath = "aria2c"' 'ariaPath = "${aria2}/bin/aria2c"'
35     '';
37     postInstall = ''
38       mkdir -p $out/share/pixmaps
39       cp src/XIVLauncher.Core/Resources/logo.png $out/share/pixmaps/xivlauncher.png
40     '';
42     postFixup = lib.optionalString useSteamRun (let
43       steam-run = (steam.override {
44         extraPkgs = pkgs: [ pkgs.libunwind ];
45       }).run;
46     in ''
47       substituteInPlace $out/bin/XIVLauncher.Core \
48         --replace 'exec' 'exec ${steam-run}/bin/steam-run'
49     '') + ''
50       wrapProgram $out/bin/XIVLauncher.Core --prefix GST_PLUGIN_SYSTEM_PATH_1_0 ":" "$GST_PLUGIN_SYSTEM_PATH_1_0"
51       # the reference to aria2 gets mangled as UTF-16LE and isn't detectable by nix: https://github.com/NixOS/nixpkgs/issues/220065
52       mkdir -p $out/nix-support
53       echo ${aria2} >> $out/nix-support/depends
54     '';
56     executables = [ "XIVLauncher.Core" ];
58     runtimeDeps = [ SDL2 libsecret glib gnutls ];
60     desktopItems = [
61       (makeDesktopItem {
62         name = "xivlauncher";
63         exec = "XIVLauncher.Core";
64         icon = "xivlauncher";
65         desktopName = "XIVLauncher";
66         comment = meta.description;
67         categories = [ "Game" ];
68         startupWMClass = "XIVLauncher.Core";
69       })
70     ];
72     meta = with lib; {
73       description = "Custom launcher for FFXIV";
74       homepage = "https://github.com/goatcorp/XIVLauncher.Core";
75       license = licenses.gpl3;
76       maintainers = with maintainers; [ sersorrel witchof0x20 ];
77       platforms = [ "x86_64-linux" ];
78       mainProgram = "XIVLauncher.Core";
79     };
80   }