diff options
author | Freya Murphy <freya@freyacat.org> | 2024-11-09 18:16:54 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-11-09 18:16:54 -0500 |
commit | 18751dd6a4122450cf947be031ecb49680009c82 (patch) | |
tree | 099bf3d87168ec84b5a9cd4101b1b3e3ba0b3e93 /home/nix/programs/nixGL.nix | |
parent | add some dev packages, clean up some things (diff) | |
download | dotfiles-guix-18751dd6a4122450cf947be031ecb49680009c82.tar.gz dotfiles-guix-18751dd6a4122450cf947be031ecb49680009c82.tar.bz2 dotfiles-guix-18751dd6a4122450cf947be031ecb49680009c82.zip |
firefox with nixGL and vertical tabs
Diffstat (limited to '')
-rw-r--r-- | home/nix/programs/nixGL.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/home/nix/programs/nixGL.nix b/home/nix/programs/nixGL.nix new file mode 100644 index 0000000..9c74fc8 --- /dev/null +++ b/home/nix/programs/nixGL.nix @@ -0,0 +1,31 @@ +{ pkgs, nixgl, ... }: + +let + nixGL = "${nixgl.packages.${pkgs.system}.nixGLIntel}/bin/nixGLIntel"; +in + pkg: + (pkg.overrideAttrs (old: { + name = "nixGL-${pkg.name}"; + buildCommand = '' + set -eo pipefail + + ${ + # Heavily inspired by https://stackoverflow.com/a/68523368/6259505 + pkgs.lib.concatStringsSep "\n" (map (outputName: '' + echo "Copying output ${outputName}" + set -x + cp -rs --no-preserve=mode "${pkg.${outputName}}" "''$${outputName}" + set +x + '') (old.outputs or [ "out" ]))} + + rm -rf $out/bin/* + shopt -s nullglob # Prevent loop from running if no files + for file in ${pkg.out}/bin/*; do + echo "#!${pkgs.bash}/bin/bash" > "$out/bin/$(basename $file)" + echo "exec -a \"\$0\" ${nixGL} $file \"\$@\"" >> "$out/bin/$(basename $file)" + chmod +x "$out/bin/$(basename $file)" + done + shopt -u nullglob # Revert nullglob back to its normal default state + ''; + })) + |