diff --git a/home/programs/picom/default.nix b/home/programs/picom/default.nix index 189b7e2b..00f27b3b 100644 --- a/home/programs/picom/default.nix +++ b/home/programs/picom/default.nix @@ -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 = { diff --git a/lib/default.nix b/lib/default.nix index 850fbdad..29668629 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -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 @@ -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: