Skip to content

Commit

Permalink
Fix nixGL-wrapped picom service calling the wrong binary path
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Dec 1, 2023
1 parent d9d8661 commit b012914
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions home/programs/picom/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ in
enable = true;
package =
if config.custom.base.non-nixos.enable
then (config.lib.custom.nixGLWrap pkgs.unstable.picom-next)
else pkgs.unstable.picom-next;
then (config.lib.custom.nixGLWrap' pkgs.picom-next "picom-next-unstable")
else pkgs.picom-next;
backend = "glx";
settings = {
blur = {
Expand Down
15 changes: 14 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ let
inherit pkgs;
rootPath = inputs.self;
} // {
nixGLWrap = pkg: pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
# Wraps all binary files of the given `pkg` with `nixGL`
nixGLWrap = pkg: pkgs.runCommand "${pkg.name}-nixgl-wrapped" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
Expand All @@ -34,6 +35,18 @@ let
chmod +x $wrapped_bin
done
'';

# Wraps the main program of the given `pkg` with `nixGL` and names the wrapper script as given `bin`
nixGLWrap' = pkg: bin: pkgs.runCommand "${pkg.name}-nixgl-wrapped" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
mkdir $out/bin
wrapped_bin=$out/bin/${bin}
echo "#!${pkgs.bash}/bin/bash" >> $wrapped_bin
echo "exec ${pkgs.lib.getExe pkgs.nixgl.auto.nixGLDefault} ${pkgs.lib.getExe pkg} \"\$@\"" >> $wrapped_bin
chmod +x $wrapped_bin
'';
});

homeModulesFor = forEachSystem (system:
Expand Down

0 comments on commit b012914

Please sign in to comment.