2024-11-16 16:04:35 +01:00
|
|
|
{
|
|
|
|
description = "Custom Firefox build";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
};
|
|
|
|
|
|
|
|
nixConfig = {
|
|
|
|
extra-experimental-features = [ "pipe-operator" "pipe-operators" ];
|
|
|
|
extra-substituters = [ "https://cache.kyouma.net" ];
|
|
|
|
extra-trusted-public-keys = [ "cache.kyouma.net:Frjwu4q1rnwE/MnSTmX9yx86GNA/z3p/oElGvucLiZg=" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, ... }: let
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
in {
|
|
|
|
packages = lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system}.pkgsMusl;
|
|
|
|
mimalloc = pkgs.mimalloc.override { secureBuild = true; };
|
2024-11-16 16:44:01 +01:00
|
|
|
extraWrapper = prevAttrs: {
|
2024-11-16 16:04:35 +01:00
|
|
|
buildCommand = prevAttrs.buildCommand + ''
|
|
|
|
sed -i \
|
|
|
|
-e '$i export MIMALLOC_PURGE_DELAY=150' \
|
|
|
|
-e '$i export MIMALLOC_PURGE_DECOMMITS=0' \
|
|
|
|
-e '$i export MIMALLOC_RESERVE_HUGE_OS_PAGES=2' \
|
2024-11-16 16:44:01 +01:00
|
|
|
"$out/bin/${prevAttrs.meta.mainProgram}"
|
2024-11-16 16:04:35 +01:00
|
|
|
'';
|
2024-11-16 16:44:01 +01:00
|
|
|
};
|
|
|
|
in {
|
|
|
|
default = self.packages.${system}.firefox;
|
|
|
|
firefox = (pkgs.wrapFirefox self.packages.${system}.firefox-unwrapped {
|
|
|
|
extraPoliciesFiles = [ ./policy.nix ];
|
|
|
|
}).overrideAttrs extraWrapper;
|
2024-11-16 16:04:35 +01:00
|
|
|
|
|
|
|
firefox-unwrapped = ((pkgs.buildMozillaMach {
|
|
|
|
pname = "firefox";
|
|
|
|
|
|
|
|
inherit (pkgs.firefox-beta-unwrapped)
|
|
|
|
src version meta tests;
|
|
|
|
|
|
|
|
extraConfigureFlags = [
|
|
|
|
"--enable-default-toolkit=cairo-gtk3-wayland-only"
|
|
|
|
];
|
|
|
|
|
|
|
|
extraBuildInputs = [ mimalloc ];
|
|
|
|
}).overrideAttrs (prevAttrs: {
|
|
|
|
env = prevAttrs.env or { } // {
|
|
|
|
LDFLAGS = lib.toList prevAttrs.env.LDFLAGS or [ ] ++ [ "-lmimalloc" ] |> toString;
|
|
|
|
};
|
|
|
|
})).override {
|
|
|
|
alsaSupport = false;
|
|
|
|
ffmpegSupport = true;
|
|
|
|
gssSupport = false;
|
|
|
|
jackSupport = false;
|
|
|
|
jemallocSupport = false;
|
|
|
|
ltoSupport = true;
|
|
|
|
pgoSupport = true;
|
|
|
|
pipewireSupport = true;
|
|
|
|
pulseaudioSupport = true;
|
|
|
|
sndioSupport = false;
|
|
|
|
waylandSupport = true;
|
|
|
|
|
|
|
|
crashreporterSupport = false;
|
|
|
|
googleAPISupport = false;
|
|
|
|
};
|
2024-11-16 16:44:01 +01:00
|
|
|
|
|
|
|
thunderbird = (pkgs.wrapThunderbird self.packages.${system}.thunderbird-unwrapped { }).overrideAttrs extraWrapper;
|
|
|
|
|
|
|
|
thunderbird-unwrapped = (pkgs.thunderbird-latest-unwrapped.overrideAttrs (prevAttrs: {
|
|
|
|
configureFlags = prevAttrs.configureFlags or [ ] ++ [
|
|
|
|
"--enable-default-toolkit=cairo-gtk3-wayland-only"
|
|
|
|
];
|
|
|
|
})).override {
|
|
|
|
alsaSupport = false;
|
|
|
|
ffmpegSupport = false;
|
|
|
|
gssSupport = false;
|
|
|
|
jackSupport = false;
|
|
|
|
jemallocSupport = false;
|
|
|
|
ltoSupport = true;
|
|
|
|
pgoSupport = true;
|
|
|
|
pipewireSupport = false;
|
|
|
|
pulseaudioSupport = false;
|
|
|
|
sndioSupport = false;
|
|
|
|
waylandSupport = true;
|
|
|
|
|
|
|
|
privacySupport = true;
|
|
|
|
drmSupport = false;
|
|
|
|
};
|
2024-11-16 16:04:35 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
hydraJobs = self.packages |> lib.foldlAttrs (jobs: system: packages: lib.recursiveUpdate jobs
|
|
|
|
(lib.mapAttrs (name: package: { ${system} = package; }) packages)) { };
|
|
|
|
};
|
|
|
|
}
|