ctucx.git: nixfiles

ctucx' nixfiles

commit 28cd9015e0b4994097ceb3560d37a7ab78765ff4
parent 215d3b79572e35c741e31d5f7f0812a9e9b8739c
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sat, 7 May 2022 13:35:11 +0200

pkgs/macApps/Thunderbird: start with MOZ_LEGACY_PROFILES=1
1 file changed, 26 insertions(+), 4 deletions(-)
M
pkgs/macApps/Thunderbird.nix
|
30
++++++++++++++++++++++++++----
diff --git a/pkgs/macApps/Thunderbird.nix b/pkgs/macApps/Thunderbird.nix
@@ -1,8 +1,12 @@
-{ stdenv, fetchurl, undmg, ... }:
+{ stdenv, fetchurl, undmg, runCommand, ... }:
 
 let
+  codesign = runCommand "codesign-build-symlinks" {} ''
+    mkdir -p $out/bin
+    ln -s /usr/bin/codesign $out/bin
+  '';
   ThunderbirdIcon = fetchurl {
-    name   = "Thnderbird.icns";
+    name   = "Thunderbird.icns";
     url    = "https://media.macosicons.com/parse/files/macOSicons/d05f6c9df12594a119f87ba6b30d663f_Thunderbird.icns";
     sha256 = "10hy7ni44azyc2glgw5dc1mxyvclxw4jxfa86b0flhyhnzcbcrfy";
   };

@@ -11,13 +15,31 @@ in stdenv.mkDerivation rec {
   pname   = "Thunderbird";
   version = "91.7.0";
 
-  buildInputs  = [ undmg ];
+  buildInputs       = [ undmg ];
+  nativeBuildInputs = [ codesign ];
+
   sourceRoot   = ".";
-  phases       = [ "unpackPhase" "installPhase" ];
+  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 {