diff options
Diffstat (limited to 'pkgs/applications/networking/browsers')
4 files changed, 36 insertions, 44 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix index ca52cf94d8c60..2f39e82f3b240 100644 --- a/pkgs/applications/networking/browsers/chromium/browser.nix +++ b/pkgs/applications/networking/browsers/chromium/browser.nix @@ -3,8 +3,6 @@ , enableWideVine, ungoogled }: -with lib; - mkChromiumDerivation (base: rec { name = "chromium-browser"; packageName = "chromium"; @@ -76,7 +74,7 @@ mkChromiumDerivation (base: rec { meta = { description = "An open source web browser from Google" - + optionalString ungoogled ", with dependencies on Google web services removed"; + + lib.optionalString ungoogled ", with dependencies on Google web services removed"; longDescription = '' Chromium is an open source web browser from Google that aims to build a safer, faster, and more stable way for all Internet users to experience @@ -86,11 +84,11 @@ mkChromiumDerivation (base: rec { homepage = if ungoogled then "https://github.com/Eloston/ungoogled-chromium" else "https://www.chromium.org/"; - maintainers = with maintainers; if ungoogled + maintainers = with lib.maintainers; if ungoogled then [ squalus primeos michaeladler ] else [ primeos thefloweringash ]; - license = if enableWideVine then licenses.unfree else licenses.bsd3; - platforms = platforms.linux; + license = if enableWideVine then lib.licenses.unfree else lib.licenses.bsd3; + platforms = lib.platforms.linux; mainProgram = "chromium"; hydraPlatforms = if (channel == "stable" || channel == "ungoogled-chromium") then ["aarch64-linux" "x86_64-linux"] diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 23b47c84555f2..413db2cf985c1 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -51,8 +51,6 @@ buildFun: -with lib; - let python3WithPackages = python3.withPackages(ps: with ps; [ ply jinja2 setuptools @@ -75,16 +73,16 @@ let let # Serialize Nix types into GN types according to this document: # https://source.chromium.org/gn/gn/+/master:docs/language.md - mkGnString = value: "\"${escape ["\"" "$" "\\"] value}\""; + mkGnString = value: "\"${lib.escape ["\"" "$" "\\"] value}\""; sanitize = value: if value == true then "true" else if value == false then "false" - else if isList value then "[${concatMapStringsSep ", " sanitize value}]" - else if isInt value then toString value - else if isString value then mkGnString value + else if lib.isList value then "[${lib.concatMapStringsSep ", " sanitize value}]" + else if lib.isInt value then toString value + else if lib.isString value then mkGnString value else throw "Unsupported type for GN value `${value}'."; toFlag = key: value: "${key}=${sanitize value}"; - in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); + in attrs: lib.concatStringsSep " " (lib.attrValues (lib.mapAttrs toFlag attrs)); # https://source.chromium.org/chromium/chromium/src/+/master:build/linux/unbundle/replace_gn_files.py gnSystemLibraries = [ @@ -151,9 +149,9 @@ let libdrm wayland mesa.drivers libxkbcommon curl libepoxy - ] ++ optional systemdSupport systemd - ++ optionals cupsSupport [ libgcrypt cups ] - ++ optional pulseSupport libpulseaudio; + ] ++ lib.optional systemdSupport systemd + ++ lib.optionals cupsSupport [ libgcrypt cups ] + ++ lib.optional pulseSupport libpulseaudio; patches = [ # Optional patch to use SOURCE_DATE_EPOCH in compute_build_timestamp.py (should be upstreamed): @@ -237,10 +235,10 @@ let # Allow building against system libraries in official builds sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' tools/generate_shim_headers/generate_shim_headers.py - '' + optionalString stdenv.isAarch64 '' + '' + lib.optionalString stdenv.isAarch64 '' substituteInPlace build/toolchain/linux/BUILD.gn \ --replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""' - '' + optionalString ungoogled '' + '' + lib.optionalString ungoogled '' ${ungoogler}/utils/prune_binaries.py . ${ungoogler}/pruning.list || echo "some errors" ${ungoogler}/utils/patches.py . ${ungoogler}/patches ${ungoogler}/utils/domain_substitution.py apply -r ${ungoogler}/domain_regex.list -f ${ungoogler}/domain_substitution.list -c ./ungoogled-domsubcache.tar.gz . @@ -300,15 +298,15 @@ let # as well to avoid incompatibilities (if this continues to be a problem # from time to time): use_system_libwayland = true; - } // optionalAttrs proprietaryCodecs { + } // lib.optionalAttrs proprietaryCodecs { # enable support for the H.264 codec proprietary_codecs = true; enable_hangout_services_extension = true; ffmpeg_branding = "Chrome"; - } // optionalAttrs pulseSupport { + } // lib.optionalAttrs pulseSupport { use_pulseaudio = true; link_pulseaudio = true; - } // optionalAttrs ungoogled (importTOML ./ungoogled-flags.toml) + } // lib.optionalAttrs ungoogled (lib.importTOML ./ungoogled-flags.toml) // (extraAttrs.gnFlags or {})); configurePhase = '' @@ -317,7 +315,7 @@ let # This is to ensure expansion of $out. libExecPath="${libExecPath}" ${python3}/bin/python3 build/linux/unbundle/replace_gn_files.py --system-libraries ${toString gnSystemLibraries} - ${gnChromium}/bin/gn gen --args=${escapeShellArg gnFlags} out/Release | tee gn-gen-outputs.txt + ${gnChromium}/bin/gn gen --args=${lib.escapeShellArg gnFlags} out/Release | tee gn-gen-outputs.txt # Fail if `gn gen` contains a WARNING. grep -o WARNING gn-gen-outputs.txt && echo "Found gn WARNING, exiting nix build" && exit 1 @@ -342,7 +340,7 @@ let ''; targets = extraAttrs.buildTargets or []; commands = map buildCommand targets; - in concatStringsSep "\n" commands; + in lib.concatStringsSep "\n" commands; postFixup = '' # Make sure that libGLESv2 is found by dlopen (if using EGL). diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix index 82d6107d119e8..01cd54cf8ee20 100644 --- a/pkgs/applications/networking/browsers/google-chrome/default.nix +++ b/pkgs/applications/networking/browsers/google-chrome/default.nix @@ -47,8 +47,6 @@ , addOpenGLRunpath }: -with lib; - let opusWithCustomModes = libopus.override { withCustomModes = true; @@ -68,8 +66,8 @@ let bzip2 libcap at-spi2-atk at-spi2-core libkrb5 libdrm libglvnd mesa coreutils libxkbcommon pipewire wayland - ] ++ optional pulseSupport libpulseaudio - ++ optional libvaSupport libva + ] ++ lib.optional pulseSupport libpulseaudio + ++ lib.optional libvaSupport libva ++ [ gtk3 ]; suffix = if channel != "stable" then "-" + channel else ""; @@ -99,8 +97,8 @@ in stdenv.mkDerivation { tar xf data.tar.xz ''; - rpath = makeLibraryPath deps + ":" + makeSearchPathOutput "lib" "lib64" deps; - binpath = makeBinPath deps; + rpath = lib.makeLibraryPath deps + ":" + lib.makeSearchPathOutput "lib" "lib64" deps; + binpath = lib.makeBinPath deps; installPhase = '' runHook preInstall @@ -149,7 +147,7 @@ in stdenv.mkDerivation { --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH:${addOpenGLRunpath.driverLink}/share" \ --set CHROME_WRAPPER "google-chrome-$dist" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ - --add-flags ${escapeShellArg commandLineArgs} + --add-flags ${lib.escapeShellArg commandLineArgs} for elf in $out/share/google/$appname/{chrome,chrome-sandbox,${crashpadHandlerBinary},nacl_helper}; do patchelf --set-rpath $rpath $elf @@ -159,7 +157,7 @@ in stdenv.mkDerivation { runHook postInstall ''; - meta = { + meta = with lib; { description = "A freeware web browser developed by Google"; homepage = "https://www.google.com/chrome/browser/"; license = licenses.unfree; diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix index 56bf61aa03bfd..43865f051ba24 100644 --- a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix +++ b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix @@ -53,10 +53,8 @@ , extraPrefs ? "" }: -with lib; - let - libPath = makeLibraryPath libPkgs; + libPath = lib.makeLibraryPath libPkgs; libPkgs = [ atk @@ -78,13 +76,13 @@ let stdenv.cc.libc zlib ] - ++ optionals pulseaudioSupport [ libpulseaudio ] - ++ optionals mediaSupport [ + ++ lib.optionals pulseaudioSupport [ libpulseaudio ] + ++ lib.optionals mediaSupport [ ffmpeg ]; # Library search path for the fte transport - fteLibPath = makeLibraryPath [ stdenv.cc.cc gmp ]; + fteLibPath = lib.makeLibraryPath [ stdenv.cc.cc gmp ]; # Upstream source version = "11.5.8"; @@ -156,7 +154,7 @@ stdenv.mkDerivation rec { libPath=${libPath}:$TBB_IN_STORE:$TBB_IN_STORE/TorBrowser/Tor # apulse uses a non-standard library path. For now special-case it. - ${optionalString (audioSupport && !pulseaudioSupport) '' + ${lib.optionalString (audioSupport && !pulseaudioSupport) '' libPath=${apulse}/lib/apulse:$libPath ''} @@ -224,7 +222,7 @@ stdenv.mkDerivation rec { clearPref("security.sandbox.content.write_path_whitelist"); ''} - ${optionalString (extraPrefs != "") '' + ${lib.optionalString (extraPrefs != "") '' ${extraPrefs} ''} EOF @@ -251,14 +249,14 @@ stdenv.mkDerivation rec { GeoIPv6File $TBB_IN_STORE/TorBrowser/Data/Tor/geoip6 EOF - WRAPPER_LD_PRELOAD=${optionalString useHardenedMalloc + WRAPPER_LD_PRELOAD=${lib.optionalString useHardenedMalloc "${graphene-hardened-malloc}/lib/libhardened_malloc.so"} - WRAPPER_XDG_DATA_DIRS=${concatMapStringsSep ":" (x: "${x}/share") [ + WRAPPER_XDG_DATA_DIRS=${lib.concatMapStringsSep ":" (x: "${x}/share") [ gnome.adwaita-icon-theme shared-mime-info ]} - WRAPPER_XDG_DATA_DIRS+=":"${concatMapStringsSep ":" (x: "${x}/share/gsettings-schemas/${x.name}") [ + WRAPPER_XDG_DATA_DIRS+=":"${lib.concatMapStringsSep ":" (x: "${x}/share/gsettings-schemas/${x.name}") [ glib gsettings-desktop-schemas gtk3 @@ -270,7 +268,7 @@ stdenv.mkDerivation rec { #! ${runtimeShell} set -o errexit -o nounset - PATH=${makeBinPath [ coreutils ]} + PATH=${lib.makeBinPath [ coreutils ]} export LC_ALL=C export LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive @@ -317,7 +315,7 @@ stdenv.mkDerivation rec { : "\''${XDG_RUNTIME_DIR:=/run/user/\$(id -u)}" : "\''${XDG_CONFIG_HOME:=\$REAL_HOME/.config}" - ${optionalString pulseaudioSupport '' + ${lib.optionalString pulseaudioSupport '' # Figure out some envvars for pulseaudio : "\''${PULSE_SERVER:=\$XDG_RUNTIME_DIR/pulse/native}" : "\''${PULSE_COOKIE:=\$XDG_CONFIG_HOME/pulse/cookie}" |