summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/firefox/wrapper.nix
diff options
context:
space:
mode:
authorYureka <yuka@yuka.dev>2021-07-13 19:04:57 +0200
committerYureka <yuka@yuka.dev>2021-08-12 08:50:41 +0200
commit711d674e1322a8ccdbf985322468da87a141bc9c (patch)
tree364d7be8bfa621567857515020cc6abf68105898 /pkgs/applications/networking/browsers/firefox/wrapper.nix
parent5e1559de12a3af65005a8ed5e7ee0325890ce60d (diff)
downloadnixpkgs-711d674e1322a8ccdbf985322468da87a141bc9c.tar
nixpkgs-711d674e1322a8ccdbf985322468da87a141bc9c.tar.gz
nixpkgs-711d674e1322a8ccdbf985322468da87a141bc9c.tar.bz2
nixpkgs-711d674e1322a8ccdbf985322468da87a141bc9c.tar.lz
nixpkgs-711d674e1322a8ccdbf985322468da87a141bc9c.tar.xz
nixpkgs-711d674e1322a8ccdbf985322468da87a141bc9c.tar.zst
nixpkgs-711d674e1322a8ccdbf985322468da87a141bc9c.zip
firefox: rename some attributes in packaging
This should not change the derivation, but the new attribute names make
more sense once we package something that is not Firefox using this
expression.
Diffstat (limited to 'pkgs/applications/networking/browsers/firefox/wrapper.nix')
-rw-r--r--pkgs/applications/networking/browsers/firefox/wrapper.nix64
1 files changed, 32 insertions, 32 deletions
diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix
index c868369b603..0ef5233ff6b 100644
--- a/pkgs/applications/networking/browsers/firefox/wrapper.nix
+++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix
@@ -20,18 +20,18 @@ browser:
 
 let
   wrapper =
-    { browserName ? browser.browserName or (lib.getName browser)
-    , pname ? browserName
+    { applicationName ? browser.applicationName or (lib.getName browser)
+    , pname ? applicationName
     , version ? lib.getVersion browser
-    , desktopName ? # browserName with first letter capitalized
-      (lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName)
+    , desktopName ? # applicationName with first letter capitalized
+      (lib.toUpper (lib.substring 0 1 applicationName) + lib.substring 1 (-1) applicationName)
     , nameSuffix ? ""
-    , icon ? browserName
+    , icon ? applicationName
     , extraNativeMessagingHosts ? []
     , pkcs11Modules ? []
     , forceWayland ? false
     , useGlvnd ? true
-    , cfg ? config.${browserName} or {}
+    , cfg ? config.${applicationName} or {}
 
     ## Following options are needed for extra prefs & policies
     # For more information about anti tracking (german website)
@@ -40,7 +40,7 @@ let
     # For more information about policies visit
     # https://github.com/mozilla/policy-templates#enterprisepoliciesenabled
     , extraPolicies ? {}
-    , firefoxLibName ? "firefox" # Important for tor package or the like
+    , libName ? "firefox" # Important for tor package or the like
     , nixExtensions ? null
     }:
 
@@ -162,15 +162,15 @@ let
         "jre"
       ];
       pluginsError =
-        "Your configuration mentions ${lib.concatMapStringsSep ", " (p: browserName + "." + p) configPlugins}. All plugin related options have been removed, since Firefox from version 52 onwards no longer supports npapi plugins (see https://support.mozilla.org/en-US/kb/npapi-plugins).";
+        "Your configuration mentions ${lib.concatMapStringsSep ", " (p: applicationName + "." + p) configPlugins}. All plugin related options have been removed, since Firefox from version 52 onwards no longer supports npapi plugins (see https://support.mozilla.org/en-US/kb/npapi-plugins).";
 
     in if configPlugins != [] then throw pluginsError else
       (stdenv.mkDerivation {
       inherit pname version;
 
       desktopItem = makeDesktopItem {
-        name = browserName;
-        exec = "${browserName}${nameSuffix} %U";
+        name = applicationName;
+        exec = "${applicationName}${nameSuffix} %U";
         inherit icon;
         comment = "";
         desktopName = "${desktopName}${nameSuffix}${lib.optionalString forceWayland " (Wayland)"}";
@@ -193,12 +193,12 @@ let
 
       buildCommand = lib.optionalString stdenv.isDarwin ''
         mkdir -p $out/Applications
-        cp -R --no-preserve=mode,ownership ${browser}/Applications/${browserName}.app $out/Applications
-        rm -f $out${browser.execdir or "/bin"}/${browserName}
+        cp -R --no-preserve=mode,ownership ${browser}/Applications/${applicationName}.app $out/Applications
+        rm -f $out${browser.execdir or "/bin"}/${applicationName}
       '' + ''
-        if [ ! -x "${browser}${browser.execdir or "/bin"}/${browserName}" ]
+        if [ ! -x "${browser}${browser.execdir or "/bin"}/${applicationName}" ]
         then
-            echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${browserName}'"
+            echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'"
             exit 1
         fi
 
@@ -213,9 +213,9 @@ let
         cd "${browser}"
         find . -type d -exec mkdir -p "$out"/{} \;
 
-        find . -type f \( -not -name "${browserName}" \) -exec ln -sT "${browser}"/{} "$out"/{} \;
+        find . -type f \( -not -name "${applicationName}" \) -exec ln -sT "${browser}"/{} "$out"/{} \;
 
-        find . -type f -name "${browserName}" -print0 | while read -d $'\0' f; do
+        find . -type f -name "${applicationName}" -print0 | while read -d $'\0' f; do
           cp -P --no-preserve=mode,ownership "${browser}/$f" "$out/$f"
           chmod a+rwx "$out/$f"
         done
@@ -236,11 +236,11 @@ let
         # create the wrapper
 
         executablePrefix="$out${browser.execdir or "/bin"}"
-        executablePath="$executablePrefix/${browserName}"
+        executablePath="$executablePrefix/${applicationName}"
 
         if [ ! -x "$executablePath" ]
         then
-            echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${browserName}'"
+            echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'"
             exit 1
         fi
 
@@ -249,25 +249,25 @@ let
           # Careful here, the file at executablePath may already be
           # a wrapper. That is why we postfix it with -old instead
           # of -wrapped.
-          oldExe="$executablePrefix"/".${browserName}"-old
+          oldExe="$executablePrefix"/".${applicationName}"-old
           mv "$executablePath" "$oldExe"
         else
           oldExe="$(readlink -v --canonicalize-existing "$executablePath")"
         fi
 
-        if [ ! -x "${browser}${browser.execdir or "/bin"}/${browserName}" ]
+        if [ ! -x "${browser}${browser.execdir or "/bin"}/${applicationName}" ]
         then
-            echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${browserName}'"
+            echo "cannot find executable file \`${browser}${browser.execdir or "/bin"}/${applicationName}'"
             exit 1
         fi
 
         makeWrapper "$oldExe" \
-          "$out${browser.execdir or "/bin"}/${browserName}${nameSuffix}" \
+          "$out${browser.execdir or "/bin"}/${applicationName}${nameSuffix}" \
             --prefix LD_LIBRARY_PATH ':' "$libs" \
             --suffix-each GTK_PATH ':' "$gtk_modules" \
             --prefix PATH ':' "${xdg-utils}/bin" \
             --suffix PATH ':' "$out${browser.execdir or "/bin"}" \
-            --set MOZ_APP_LAUNCHER "${browserName}${nameSuffix}" \
+            --set MOZ_APP_LAUNCHER "${applicationName}${nameSuffix}" \
             --set MOZ_SYSTEM_DIR "$out/lib/mozilla" \
             --set MOZ_LEGACY_PROFILES 1 \
             --set MOZ_ALLOW_DOWNGRADE 1 \
@@ -290,7 +290,7 @@ let
             mkdir -p "$out/share/icons/hicolor/''${res}x''${res}/apps"
             icon=( "${browser}/lib/"*"/browser/chrome/icons/default/default''${res}.png" )
               if [ -e "$icon" ]; then ln -s "$icon" \
-                "$out/share/icons/hicolor/''${res}x''${res}/apps/${browserName}.png"
+                "$out/share/icons/hicolor/''${res}x''${res}/apps/${applicationName}.png"
               fi
             done
         fi
@@ -314,24 +314,24 @@ let
         #                       #
         #########################
         # user customization
-        mkdir -p $out/lib/${firefoxLibName}
+        mkdir -p $out/lib/${libName}
 
         # creating policies.json
-        mkdir -p "$out/lib/${firefoxLibName}/distribution"
+        mkdir -p "$out/lib/${libName}/distribution"
 
-        POL_PATH="$out/lib/${firefoxLibName}/distribution/policies.json"
+        POL_PATH="$out/lib/${libName}/distribution/policies.json"
         rm -f "$POL_PATH"
         cat ${policiesJson} >> "$POL_PATH"
 
         # preparing for autoconfig
-        mkdir -p "$out/lib/${firefoxLibName}/defaults/pref"
+        mkdir -p "$out/lib/${libName}/defaults/pref"
 
-        echo 'pref("general.config.filename", "mozilla.cfg");' > "$out/lib/${firefoxLibName}/defaults/pref/autoconfig.js"
-        echo 'pref("general.config.obscure_value", 0);' >> "$out/lib/${firefoxLibName}/defaults/pref/autoconfig.js"
+        echo 'pref("general.config.filename", "mozilla.cfg");' > "$out/lib/${libName}/defaults/pref/autoconfig.js"
+        echo 'pref("general.config.obscure_value", 0);' >> "$out/lib/${libName}/defaults/pref/autoconfig.js"
 
-        cat > "$out/lib/${firefoxLibName}/mozilla.cfg" < ${mozillaCfg}
+        cat > "$out/lib/${libName}/mozilla.cfg" < ${mozillaCfg}
 
-        mkdir -p $out/lib/${firefoxLibName}/distribution/extensions
+        mkdir -p $out/lib/${libName}/distribution/extensions
 
         #############################
         #                           #