git.iko.soy/typeable/nixpkgs
on master help sign in
cataclysm-dda{,-git}: create app launcher on Darwin
commit7287a9e91d9702fbec8899e7f6ffad7551a0f269 authorMitsuhiro Nakamura <m.nacamura@gmail.com> dateMon 22 Jan 2018, 12:19 (9 years ago) parent728a132
2 files changed+30−2
pkgs/games/cataclysm-dda/default.nix+19−2 pkgs/games/cataclysm-dda/git.nix+11
pkgs/games/cataclysm-dda/default.nix+19−2
@@ -1,5 +1,5 @@
11{ fetchFromGitHub, stdenv, makeWrapper, pkgconfig, ncurses, lua, SDL2, SDL2_image, SDL2_ttf,
2−SDL2_mixer, freetype, gettext, Cocoa }:
2+SDL2_mixer, freetype, gettext, Cocoa, libicns }:
33
44stdenv.mkDerivation rec {
55 version = "0.C";
@@ -12,7 +12,8 @@ stdenv.mkDerivation rec {
1212 sha256 = "03sdzsk4qdq99qckq0axbsvg1apn6xizscd8pwp5w6kq2fyj5xkv";
1313 };
1414
15− nativeBuildInputs = [ makeWrapper pkgconfig ];
15+ nativeBuildInputs = [ makeWrapper pkgconfig ]
16+ ++ stdenv.lib.optionals stdenv.isDarwin [ libicns ];
1617
1718 buildInputs = [ ncurses lua SDL2 SDL2_image SDL2_ttf SDL2_mixer freetype gettext ]
1819 ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ];
@@ -34,9 +35,25 @@ stdenv.mkDerivation rec {
3435 "OSX_MIN=10.6" # SDL for macOS only supports deploying on 10.6 and above
3536 ];
3637
38+ postBuild = ''
39+ # iconutil on macOS is not available in nixpkgs
40+ png2icns data/osx/AppIcon.icns data/osx/AppIcon.iconset/*
41+ '';
42+
3743 postInstall = ''
3844 wrapProgram $out/bin/cataclysm-tiles \
3945 --add-flags "--datadir $out/share/"
46+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
47+ app=$out/Applications/Cataclysm.app
48+ install -D -m 444 data/osx/Info.plist -t $app/Contents
49+ install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources
50+ mkdir $app/Contents/MacOS
51+ launcher=$app/Contents/MacOS/Cataclysm.sh
52+ cat << SCRIPT > $launcher
53+ #!/bin/sh
54+ $out/bin/cataclysm-tiles
55+ SCRIPT
56+ chmod 555 $launcher
4057 '';
4158
4259 # Disable, possible problems with hydra
pkgs/games/cataclysm-dda/git.nix+11
@@ -36,6 +36,17 @@ stdenv.mkDerivation rec {
3636 postInstall = ''
3737 wrapProgram $out/bin/cataclysm-tiles \
3838 --add-flags "--datadir $out/share/cataclysm-dda/"
39+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
40+ app=$out/Applications/Cataclysm.app
41+ install -D -m 444 data/osx/Info.plist -t $app/Contents
42+ install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources
43+ mkdir $app/Contents/MacOS
44+ launcher=$app/Contents/MacOS/Cataclysm.sh
45+ cat << SCRIPT > $launcher
46+ #!/bin/sh
47+ $out/bin/cataclysm-tiles
48+ SCRIPT
49+ chmod 555 $launcher
3950 '';
4051
4152 # https://hydra.nixos.org/build/65193254