firefox/flake.nix

113 lines
3.4 KiB
Nix
Raw Normal View History

2024-11-16 16:04:35 +01:00
{
description = "Custom Firefox build";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2024-11-16 17:03:21 +01:00
neoidiosyn = {
url = "git+https://woof.rip/mikael/neoidiosyn.git";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-11-16 16:04:35 +01:00
};
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=" ];
};
2024-11-16 17:03:21 +01:00
outputs = { self, nixpkgs, neoidiosyn, ... }: let
2024-11-16 16:04:35 +01:00
inherit (nixpkgs) lib;
in {
2024-11-16 17:03:21 +01:00
packages = lib.mapAttrs (system: pkgs: let
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
};
2024-11-16 17:03:21 +01:00
wrapFirefox = pkgs.wrapFirefox.override {
ffmpeg = pkgs.ffmpeg.override {
ffmpegVariant = "headless";
withAlsa = false;
withAom = false;
withCodec2 = true;
withDrm = false;
withGnutls = false;
withSsh = false;
withV4l2 = false;
withNetwork = false;
withBin = false;
withLib = true;
withDocumentation = false;
withStripping = true;
};
};
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;
2024-11-16 17:03:21 +01:00
extraConfigureFlags = [ "--enable-default-toolkit=cairo-gtk3-wayland-only" ];
}).overrideAttrs {
autoVarInit = "zero";
boundsCheck = true;
}).override {
2024-11-16 16:04:35 +01:00
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: {
2024-11-16 17:03:21 +01:00
autoVarInit = "zero";
boundsCheck = true;
configureFlags = prevAttrs.configureFlags or [ ]
++ [ "--enable-default-toolkit=cairo-gtk3-wayland-only" ];
2024-11-16 16:44:01 +01:00
})).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 17:03:21 +01:00
}) neoidiosyn.legacyPackages;
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)) { };
};
}