firefox: wrap with nixGL better

This commit is contained in:
Motiejus Jakštys 2024-02-02 13:51:43 +02:00 committed by Motiejus Jakštys
parent eb47df5e5a
commit 9f61b9a378
1 changed files with 38 additions and 10 deletions

View File

@ -31,6 +31,43 @@
-- "$@"
'';
};
# from https://github.com/Gerg-L/demoninajar/blob/39964f198dbfa34c21f81c35370fab312b476051/homes/veritas_manjaro/nixGL.nix#L42
mkWrapped = wrap: orig-pkg: execName:
pkgs.makeOverridable
(
attrs: let
pkg = orig-pkg.override attrs;
outs = pkg.meta.outputsToInstall;
paths = pkgs.lib.attrsets.attrVals outs pkg;
nonTrivialOuts = pkgs.lib.lists.remove "out" outs;
metaAttributes =
pkgs.lib.attrsets.getAttrs
(
[
"name"
"pname"
"version"
"meta"
]
++ nonTrivialOuts
)
pkg;
in
pkgs.symlinkJoin (
{
inherit paths;
nativeBuildInputs = [pkgs.makeBinaryWrapper];
postBuild = ''
mv $out/bin/${execName} $out/bin/.${execName}-mkWrapped-original
makeWrapper ${wrap}/bin/${wrap.name} $out/bin/${execName} --add-flags $out/bin/.${execName}-mkWrapped-original
'';
}
// metaAttributes
)
)
{};
glintel = mkWrapped pkgs.nixgl.nixGLIntel;
in {
home = {
inherit stateVersion;
@ -49,7 +86,6 @@ in {
])
(lib.mkIf hmOnly [
pkgs.nixgl.nixGLIntel
ncdu
tokei
scrcpy
@ -58,14 +94,6 @@ in {
vimv-rs
bandwhich
hyperfine
(runCommand "ff" {} ''
mkdir -p $out/bin
{
echo '#!/bin/sh'
echo 'exec ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ${firefox}/bin/firefox "$@"'
} > $out/bin/ff
chmod a+x $out/bin/ff
'')
])
];
@ -74,7 +102,7 @@ in {
firefox = lib.mkIf fullDesktop {
enable = true;
package = pkgs.firefox-bin;
package = glintel pkgs.firefox-bin "firefox";
policies.DisableAppUpdate = true;
profiles = {
xdefault = {