@ -20,18 +20,18 @@ browser:
let
wrapper =
{ browser Name ? browser . browser Name or ( lib . getName browser )
, pname ? browser Name
{ application Name ? browser . application Name or ( lib . getName browser )
, pname ? application Name
, version ? lib . getVersion browser
, desktopName ? # browser Name with first letter capitalized
( lib . toUpper ( lib . substring 0 1 browser Name) + lib . substring 1 ( -1 ) browser Name)
, desktopName ? # application Name with first letter capitalized
( lib . toUpper ( lib . substring 0 1 application Name) + lib . substring 1 ( -1 ) application Name)
, nameSuffix ? " "
, icon ? browser Name
, icon ? application Name
, extraNativeMessagingHosts ? [ ]
, pkcs11Modules ? [ ]
, forceWayland ? false
, useGlvnd ? true
, cfg ? config . ${ browser Name} or { }
, cfg ? config . ${ application Name} 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 ? { }
, firefoxL ibName ? " f i r e f o x " # Important for tor package or the like
, l ibName ? " f i r e f o x " # Important for tor package or the like
, nixExtensions ? null
} :
@ -162,15 +162,15 @@ let
" j r e "
] ;
pluginsError =
" Y o u r c o n f i g u r a t i o n m e n t i o n s ${ lib . concatMapStringsSep " , " ( p : browser Name + " . " + p ) configPlugins } . A l l p l u g i n r e l a t e d o p t i o n s h a v e b e e n r e m o v e d , s i n c e F i r e f o x f r o m v e r s i o n 5 2 o n w a r d s n o l o n g e r s u p p o r t s n p a p i p l u g i n s ( s e e h t t p s : / / s u p p o r t . m o z i l l a . o r g / e n - U S / k b / n p a p i - p l u g i n s ) . " ;
" Y o u r c o n f i g u r a t i o n m e n t i o n s ${ lib . concatMapStringsSep " , " ( p : application Name + " . " + p ) configPlugins } . A l l p l u g i n r e l a t e d o p t i o n s h a v e b e e n r e m o v e d , s i n c e F i r e f o x f r o m v e r s i o n 5 2 o n w a r d s n o l o n g e r s u p p o r t s n p a p i p l u g i n s ( s e e h t t p s : / / s u p p o r t . m o z i l l a . o r g / e n - U S / k b / n p a p i - p l u g i n s ) . " ;
in if configPlugins != [ ] then throw pluginsError else
( stdenv . mkDerivation {
inherit pname version ;
desktopItem = makeDesktopItem {
name = browser Name;
exec = " ${ browser Name} ${ nameSuffix } % U " ;
name = application Name;
exec = " ${ application Name} ${ nameSuffix } % U " ;
inherit icon ;
comment = " " ;
desktopName = " ${ desktopName } ${ nameSuffix } ${ lib . optionalString forceWayland " ( W a y l a n d ) " } " ;
@ -193,12 +193,12 @@ let
buildCommand = lib . optionalString stdenv . isDarwin ''
mkdir - p $ out/Applications
cp - R - - no-preserve = mode , ownership $ { browser } /Applications / $ { browser Name} . app $ out/Applications
rm - f $ out $ { browser . execdir or " / b i n " } / $ { browser Name}
cp - R - - no-preserve = mode , ownership $ { browser } /Applications / $ { application Name} . app $ out/Applications
rm - f $ out $ { browser . execdir or " / b i n " } / $ { application Name}
'' + ''
if [ ! - x " ${ browser } ${ browser . execdir or " / b i n " } / ${ browser Name} " ]
if [ ! - x " ${ browser } ${ browser . execdir or " / b i n " } / ${ application Name} " ]
then
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } ${ browser . execdir or " / b i n " } / ${ browser Name} ' "
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } ${ browser . execdir or " / b i n " } / ${ application Name} ' "
exit 1
fi
@ -213,9 +213,9 @@ let
cd " ${ browser } "
find . - type d - exec mkdir - p " $ o u t " / { } \ ;
find . - type f \ ( - not - name " ${ browser Name} " \ ) - exec ln - sT " ${ browser } " / { } " $ o u t " / { } \ ;
find . - type f \ ( - not - name " ${ application Name} " \ ) - exec ln - sT " ${ browser } " / { } " $ o u t " / { } \ ;
find . - type f - name " ${ browser Name} " - print0 | while read - d $ ' \ 0 ' f ; do
find . - type f - name " ${ application Name} " - print0 | while read - d $ ' \ 0 ' f ; do
cp - P - - no-preserve = mode , ownership " ${ browser } / $ f " " $ o u t / $ f "
chmod a + rwx " $ o u t / $ f "
done
@ -236,11 +236,11 @@ let
# create the wrapper
executablePrefix = " $ o u t ${ browser . execdir or " / b i n " } "
executablePath = " $ e x e c u t a b l e P r e f i x / ${ browser Name} "
executablePath = " $ e x e c u t a b l e P r e f i x / ${ application Name} "
if [ ! - x " $ e x e c u t a b l e P a t h " ]
then
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } ${ browser . execdir or " / b i n " } / ${ browser Name} ' "
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } ${ browser . execdir or " / b i n " } / ${ application Name} ' "
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 = " $ e x e c u t a b l e P r e f i x " / " . ${ browser Name} " - old
oldExe = " $ e x e c u t a b l e P r e f i x " / " . ${ application Name} " - old
mv " $ e x e c u t a b l e P a t h " " $ o l d E x e "
else
oldExe = " $ ( r e a d l i n k - v - - c a n o n i c a l i z e - e x i s t i n g " $ executablePath " ) "
fi
if [ ! - x " ${ browser } ${ browser . execdir or " / b i n " } / ${ browser Name} " ]
if [ ! - x " ${ browser } ${ browser . execdir or " / b i n " } / ${ application Name} " ]
then
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } ${ browser . execdir or " / b i n " } / ${ browser Name} ' "
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } ${ browser . execdir or " / b i n " } / ${ application Name} ' "
exit 1
fi
makeWrapper " $ o l d E x e " \
" $ o u t ${ browser . execdir or " / b i n " } / ${ browser Name} ${ nameSuffix } " \
" $ o u t ${ browser . execdir or " / b i n " } / ${ application Name} ${ nameSuffix } " \
- - prefix LD_LIBRARY_PATH ' : ' " $ l i b s " \
- - suffix-each GTK_PATH ' : ' " $ g t k _ m o d u l e s " \
- - prefix PATH ' : ' " ${ xdg-utils } / b i n " \
- - suffix PATH ' : ' " $ o u t ${ browser . execdir or " / b i n " } " \
- - set MOZ_APP_LAUNCHER " ${ browser Name} ${ nameSuffix } " \
- - set MOZ_APP_LAUNCHER " ${ application Name} ${ nameSuffix } " \
- - set MOZ_SYSTEM_DIR " $ o u t / l i b / m o z i l l a " \
- - set MOZ_LEGACY_PROFILES 1 \
- - set MOZ_ALLOW_DOWNGRADE 1 \
@ -290,7 +290,7 @@ let
mkdir - p " $ o u t / s h a r e / i c o n s / h i c o l o r / ' ' ${ res } x ' ' ${ res } / a p p s "
icon = ( " ${ browser } / l i b / " * " / b r o w s e r / c h r o m e / i c o n s / d e f a u l t / d e f a u l t ' ' ${ res } . p n g " )
if [ - e " $ i c o n " ] ; then ln - s " $ i c o n " \
" $ o u t / s h a r e / i c o n s / h i c o l o r / ' ' ${ res } x ' ' ${ res } / a p p s / ${ browser Name} . p n g "
" $ o u t / s h a r e / i c o n s / h i c o l o r / ' ' ${ res } x ' ' ${ res } / a p p s / ${ application Name} . p n g "
fi
done
fi
@ -314,24 +314,24 @@ let
# #
#########################
# user customization
mkdir - p $ out/lib / $ { firefoxL ibName}
mkdir - p $ out/lib / $ { l ibName}
# creating policies.json
mkdir - p " $ o u t / l i b / ${ firefoxL ibName} / d i s t r i b u t i o n "
mkdir - p " $ o u t / l i b / ${ l ibName} / d i s t r i b u t i o n "
POL_PATH = " $ o u t / l i b / ${ firefoxL ibName} / d i s t r i b u t i o n / p o l i c i e s . j s o n "
POL_PATH = " $ o u t / l i b / ${ l ibName} / d i s t r i b u t i o n / p o l i c i e s . j s o n "
rm - f " $ P O L _ P A T H "
cat $ { policiesJson } > > " $ P O L _ P A T H "
# preparing for autoconfig
mkdir - p " $ o u t / l i b / ${ firefoxL ibName} / d e f a u l t s / p r e f "
mkdir - p " $ o u t / l i b / ${ l ibName} / d e f a u l t s / p r e f "
echo ' pref ( " g e n e r a l . c o n f i g . f i l e n a m e " , " m o z i l l a . c f g " ) ; ' > " $ o u t / l i b / ${ firefoxL ibName} / d e f a u l t s / p r e f / a u t o c o n f i g . j s "
echo ' pref ( " g e n e r a l . c o n f i g . o b s c u r e _ v a l u e " , 0 ) ; ' > > " $ o u t / l i b / ${ firefoxL ibName} / d e f a u l t s / p r e f / a u t o c o n f i g . j s "
echo ' pref ( " g e n e r a l . c o n f i g . f i l e n a m e " , " m o z i l l a . c f g " ) ; ' > " $ o u t / l i b / ${ l ibName} / d e f a u l t s / p r e f / a u t o c o n f i g . j s "
echo ' pref ( " g e n e r a l . c o n f i g . o b s c u r e _ v a l u e " , 0 ) ; ' > > " $ o u t / l i b / ${ l ibName} / d e f a u l t s / p r e f / a u t o c o n f i g . j s "
cat > " $ o u t / l i b / ${ firefoxL ibName} / m o z i l l a . c f g " < $ { mozillaCfg }
cat > " $ o u t / l i b / ${ l ibName} / m o z i l l a . c f g " < $ { mozillaCfg }
mkdir - p $ out/lib / $ { firefoxL ibName} /distribution/extensions
mkdir - p $ out/lib / $ { l ibName} /distribution/extensions
#############################
# #