summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/networking/browsers/palemoon/bin.nix180
-rw-r--r--pkgs/applications/networking/browsers/palemoon/zz-disableUpdater.js7
-rw-r--r--pkgs/top-level/all-packages.nix1
3 files changed, 188 insertions, 0 deletions
diff --git a/pkgs/applications/networking/browsers/palemoon/bin.nix b/pkgs/applications/networking/browsers/palemoon/bin.nix
new file mode 100644
index 00000000000..ade66f76e25
--- /dev/null
+++ b/pkgs/applications/networking/browsers/palemoon/bin.nix
@@ -0,0 +1,180 @@
+{ stdenv
+, lib
+, fetchzip
+, alsa-lib
+, autoPatchelfHook
+, copyDesktopItems
+, dbus-glib
+, ffmpeg
+, gtk2-x11
+, withGTK3 ? true
+, gtk3
+, libXt
+, libpulseaudio
+, makeDesktopItem
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "palemoon-bin";
+  version = "32.0.0";
+
+  src = fetchzip {
+    url = "http://linux.palemoon.org/datastore/release/palemoon-${version}.linux-x86_64-gtk${if withGTK3 then "3" else "2"}.tar.xz";
+    hash = if withGTK3 then
+      "sha256-KipzrQEbwd3np3t2oTq2eHHLUPtnC/nnGYMGmFc7arw="
+    else
+      "sha256-dbHGThzLx23Ws0nfGTEYrQp0g+hYwkk1bOczQwt4NYg=";
+  };
+
+  preferLocalBuild = true;
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+    copyDesktopItems
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    alsa-lib
+    dbus-glib
+    gtk2-x11
+    libXt
+    stdenv.cc.cc.lib
+  ] ++ lib.optionals withGTK3 [
+    gtk3
+  ];
+
+  desktopItems = [(makeDesktopItem rec {
+    name = pname;
+    desktopName = "Pale Moon Web Browser";
+    comment = "Browse the World Wide Web";
+    keywords = [
+      "Internet"
+      "WWW"
+      "Browser"
+      "Web"
+      "Explorer"
+    ];
+    exec = "palemoon %u";
+    terminal = false;
+    type = "Application";
+    icon = "palemoon";
+    categories = [
+      "Network"
+      "WebBrowser"
+    ];
+    mimeTypes = [
+      "text/html"
+      "text/xml"
+      "application/xhtml+xml"
+      "application/xml"
+      "application/rss+xml"
+      "application/rdf+xml"
+      "image/gif"
+      "image/jpeg"
+      "image/png"
+      "x-scheme-handler/http"
+      "x-scheme-handler/https"
+      "x-scheme-handler/ftp"
+      "x-scheme-handler/chrome"
+      "video/webm"
+      "application/x-xpinstall"
+    ];
+    startupNotify = true;
+    startupWMClass = "Pale moon";
+    extraConfig = {
+      X-MultipleArgs = "false";
+    };
+    actions = {
+      "NewTab" = {
+        name = "Open new tab";
+        exec = "palemoon -new-tab https://start.palemoon.org";
+      };
+      "NewWindow" = {
+        name = "Open new window";
+        exec = "palemoon -new-window";
+      };
+      "NewPrivateWindow" = {
+        name = "Open new private window";
+        exec = "palemoon -private-window";
+      };
+      "ProfileManager" = {
+        name = "Open the Profile Manager";
+        exec = "palemoon --ProfileManager";
+      };
+    };
+  })];
+
+  dontConfigure = true;
+  dontBuild = true;
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/{bin,lib/palemoon}
+    cp -R * $out/lib/palemoon/
+
+    ln -s $out/{lib/palemoon,bin}/palemoon
+
+    for iconpath in chrome/icons/default/default{16,32,48} icons/mozicon128; do
+      n=''${iconpath//[^0-9]/}
+      size=$n"x"$n
+      mkdir -p $out/share/icons/hicolor/$size/apps
+      ln -s $out/lib/palemoon/browser/"$iconpath".png $out/share/icons/hicolor/$size/apps/palemoon.png
+    done
+
+    # Disable built-in updater
+    # https://forum.palemoon.org/viewtopic.php?f=5&t=25073&p=197771#p197747
+    # > Please do not take this as permission to change, remove, or alter any other preferences as that is forbidden
+    # > without express permission according to the Pale Moon Redistribution License.
+    # > We are allowing this one and **ONLY** one exception in order to properly facilitate [package manager] repacks.
+    install -Dm644 ${./zz-disableUpdater.js} $out/lib/palemoon/browser/defaults/preferences/zz-disableUpdates.js
+
+    runHook postInstall
+  '';
+
+  dontWrapGApps = true;
+
+  preFixup = ''
+    # Make optional dependencies available
+    gappsWrapperArgs+=(
+      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
+        ffmpeg
+        libpulseaudio
+      ]}"
+    )
+    wrapGApp $out/lib/palemoon/palemoon
+  '';
+
+  meta = with lib; {
+    homepage = "https://www.palemoon.org/";
+    description = "An Open Source, Goanna-based web browser focusing on efficiency and customization";
+    longDescription = ''
+      Pale Moon is an Open Source, Goanna-based web browser focusing on
+      efficiency and customization.
+      Pale Moon offers you a browsing experience in a browser completely built
+      from its own, independently developed source that has been forked off from
+      Firefox/Mozilla code a number of years ago, with carefully selected
+      features and optimizations to improve the browser's stability and user
+      experience, while offering full customization and a growing collection of
+      extensions and themes to make the browser truly your own.
+    '';
+    changelog = "https://repo.palemoon.org/MoonchildProductions/Pale-Moon/releases/tag/${version}_Release";
+    license = [
+      licenses.mpl20
+      {
+        fullName = "Pale Moon Redistribution License";
+        url = "https://www.palemoon.org/redist.shtml";
+        # TODO free, redistributable? Has strict limitations on what modifications may be done & shipped by packagers
+      }
+    ];
+    maintainers = with maintainers; [ AndersonTorres OPNA2608 ];
+    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+    mainProgram = "palemoon";
+    platforms = [ "x86_64-linux" ];
+    hydraPlatforms = [];
+  };
+}
diff --git a/pkgs/applications/networking/browsers/palemoon/zz-disableUpdater.js b/pkgs/applications/networking/browsers/palemoon/zz-disableUpdater.js
new file mode 100644
index 00000000000..50b8a79f627
--- /dev/null
+++ b/pkgs/applications/networking/browsers/palemoon/zz-disableUpdater.js
@@ -0,0 +1,7 @@
+/* https://forum.palemoon.org/viewtopic.php?f=5&t=25073&p=197771#p197747 */
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pref("app.update.enabled", false);
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7b234f09363..1280331eb5a 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -32196,6 +32196,7 @@ with pkgs;
   osmscout-server = libsForQt5.callPackage ../applications/misc/osmscout-server { };
 
   palemoon = callPackage ../applications/networking/browsers/palemoon { };
+  palemoon-bin = callPackage ../applications/networking/browsers/palemoon/bin.nix { };
 
   pamix = callPackage ../applications/audio/pamix { };