acr-cli: init at 0.14 (#359508)
[NixPkgs.git] / pkgs / by-name / am / amiberry / package.nix
blob82c9c2a8aac6a8ae3c96c9a08a0d8964f060f44d
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   copyDesktopItems,
7   makeWrapper,
8   flac,
9   libmpeg2,
10   libmpg123,
11   libpng,
12   libserialport,
13   portmidi,
14   SDL2,
15   SDL2_image,
16   SDL2_ttf,
17   makeDesktopItem,
20 stdenv.mkDerivation (finalAttrs: {
21   pname = "amiberry";
22   version = "5.7.4";
24   src = fetchFromGitHub {
25     owner = "BlitterStudio";
26     repo = "amiberry";
27     rev = "refs/tags/v${finalAttrs.version}";
28     hash = "sha256-EOoVJYefX2pQ2Zz9bLD1RS47u/+7ZWTMwZYha0juF64=";
29   };
31   nativeBuildInputs = [
32     cmake
33     copyDesktopItems
34     makeWrapper
35   ];
37   buildInputs = [
38     flac
39     libmpeg2
40     libmpg123
41     libpng
42     libserialport
43     portmidi
44     SDL2
45     SDL2_image
46     SDL2_ttf
47   ];
49   enableParallelBuilding = true;
51   # Amiberry has traditionally behaved as a "Portable" app, meaning that it was designed to expect everything
52   # under the same directory. This is not compatible with Nix package conventions.
53   # The Amiberry behavior has changed since versions 5.7.4 and 6.3.4 (see
54   # https://github.com/BlitterStudio/amiberry/wiki/FAQ#q-where-does-amiberry-look-for-its-files-can-i-change-that
55   # for more information), however this is still not compatible with Nix packaging. The AMIBERRY_DATA_DIR can go
56   # in the nix store but the Amiberry configuration files must be stored in a user writable location.
57   # Fortunately Amiberry provides environment variables for specifying these locations which we can supply with the
58   # wrapper script below.
59   # One more caveat: Amiberry expects the configuration files path (AMIBERRY_HOME_DIR) to exist, otherwise it will
60   # fall back to behaving like a "Portable" app. The wrapper below ensures that the AMIBERRY_HOME_DIR path exists,
61   # preventing that fallback.
62   installPhase = ''
63     runHook preInstall
64     mkdir -p $out/bin
65     cp amiberry $out/bin/
66     cp -r abr data $out/
67     install -Dm444 data/amiberry.png $out/share/icons/hicolor/256x256/apps/amiberry.png
68     wrapProgram $out/bin/amiberry \
69       --set-default AMIBERRY_DATA_DIR $out \
70       --run 'AMIBERRY_HOME_DIR="$HOME/.amiberry"' \
71       --run 'mkdir -p \
72         $AMIBERRY_HOME_DIR/kickstarts \
73         $AMIBERRY_HOME_DIR/conf \
74         $AMIBERRY_HOME_DIR/nvram \
75         $AMIBERRY_HOME_DIR/plugins \
76         $AMIBERRY_HOME_DIR/screenshots \
77         $AMIBERRY_HOME_DIR/savestates \
78         $AMIBERRY_HOME_DIR/controllers \
79         $AMIBERRY_HOME_DIR/whdboot \
80         $AMIBERRY_HOME_DIR/lha \
81         $AMIBERRY_HOME_DIR/floppies \
82         $AMIBERRY_HOME_DIR/cdroms \
83         $AMIBERRY_HOME_DIR/harddrives'
84     runHook postInstall
85   '';
87   desktopItems = [
88     (makeDesktopItem {
89       name = "amiberry";
90       desktopName = "Amiberry";
91       exec = "amiberry";
92       comment = "Amiga emulator";
93       icon = "amiberry";
94       categories = [
95         "System"
96         "Emulator"
97       ];
98     })
99   ];
101   meta = with lib; {
102     homepage = "https://github.com/BlitterStudio/amiberry";
103     description = "Optimized Amiga emulator for Linux/macOS";
104     license = licenses.gpl3;
105     platforms = platforms.linux;
106     maintainers = with maintainers; [ michaelshmitty ];
107     mainProgram = "amiberry";
108   };