ctucx.git: nixfiles

ctucx' nixfiles

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 
{ stdenv, fetchurl, undmg, runCommand, ... }:

let
  codesign = runCommand "codesign-build-symlinks" {} ''
    mkdir -p $out/bin
    ln -s /usr/bin/codesign $out/bin
  '';

  ThunderbirdIcon = fetchurl {
    name   = "Thunderbird.icns";
    url    = "https://media.macosicons.com/parse/files/macOSicons/d05f6c9df12594a119f87ba6b30d663f_Thunderbird.icns";
    sha256 = "10hy7ni44azyc2glgw5dc1mxyvclxw4jxfa86b0flhyhnzcbcrfy";
  };

in stdenv.mkDerivation rec {
  pname   = "Thunderbird";
  version = "91.10.0";

  buildInputs       = [ undmg ];
  nativeBuildInputs = [ codesign ];

  sourceRoot   = ".";
  phases       = [ "unpackPhase" "patchPhase" "installPhase" ];


  patchPhase   = ''
    substituteInPlace ./Thunderbird.app/Contents/Info.plist --replace "</dict>
</plist>" "	<key>LSEnvironment</key>
	<dict>
		<key>MOZ_LEGACY_PROFILES</key>
		<string>1</string>
	</dict>
</dict>
</plist>
"
  '';

  installPhase = ''
    mkdir -p "$out/Applications"
    cp -r Thunderbird.app "$out/Applications/Thunderbird.app"
    cp -r ${ThunderbirdIcon} "$out/Applications/Thunderbird.app/Contents/Resources/thunderbird.icns"

    codesign --remove-signature "$out/Applications/Thunderbird.app"
  '';

  src = fetchurl {
    name   = "Thunderbird-${version}.dmg";
    url    = "https://download-installer.cdn.mozilla.net/pub/thunderbird/releases/${version}/mac/en-US/Thunderbird%20${version}.dmg";
    sha256 = "0pl46fl7c4807xb6b0ywbk03hdg1prllcd28csgrh8c2kf390cj0";
  };

#  meta = with stdenv.lib; {
#    description = "Thunderbird is a free email application that’s easy to set up and customize - and it’s loaded with great features!";
#    homepage    = "https://www.thunderbird.net/en-US";
#    platforms   = platforms.darwin;
#  };
}