Skip to content

Commit

Permalink
Add nixGL wrapper lib function
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Jan 12, 2023
1 parent 74f364e commit ed50e15
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
21 changes: 17 additions & 4 deletions flake/per-system.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let

overlays = [
(final: prev: {
inherit unstable nixgl nur;
inherit unstable nur;
inherit (inputs.agenix-cli.packages."${system}") agenix-cli;
inherit (inputs.kmonad.packages."${system}") kmonad;

Expand All @@ -44,9 +44,22 @@ let
inherit config overlays system;
};

customLib = inputs.flake-commons.lib {
inherit (inputs.nixpkgs) lib;
inherit pkgs rootPath;
customLib = inputs.flake-commons.lib
{
inherit (inputs.nixpkgs) lib;
inherit pkgs rootPath;
} // {
nixGLWrap = pkg: pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
mkdir $out
ln -s ${pkg}/* $out
rm $out/bin
mkdir $out/bin
for bin in ${pkg}/bin/*; do
wrapped_bin=$out/bin/$(basename $bin)
echo "exec ${pkgs.lib.getExe nixgl.nixgl.auto.nixGLDefault} $bin \"\$@\"" > $wrapped_bin
chmod +x $wrapped_bin
done
'';
};

machNix = inputs.mach-nix.lib."${system}";
Expand Down
12 changes: 4 additions & 8 deletions home/roles/desktop/alacritty/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ in

programs.alacritty = {
enable = true;
package =
if config.custom.base.non-nixos.enable
then (hiPrio (config.lib.custom.nixGLWrap pkgs.alacritty))
else pkgs.alacritty;
settings = {
env.TERM = "xterm-256color";
window = {
Expand Down Expand Up @@ -99,13 +103,5 @@ in
];
};
};
} // mkIf config.custom.base.non-nixos.enable {
custom.roles.desktop.alacritty.spawnCmd = "nixGL alacritty";

home = {
packages = with pkgs; [
nixgl.nixgl.auto.nixGLDefault
];
};
};
}
8 changes: 5 additions & 3 deletions home/roles/web/nextcloud-client/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ with lib;
let

cfg = config.custom.roles.web.nextcloud-client;
pkg =
if config.custom.base.non-nixos.enable
then (config.lib.custom.nixGLWrap pkgs.nextcloud-client)
else pkgs.nextcloud-client;

in

Expand All @@ -16,9 +20,7 @@ in
};

config = mkIf cfg.enable {
home.packages = [
pkgs.nextcloud-client
];
home.packages = [ pkg ];

services.nextcloud-client = {
enable = true;
Expand Down

0 comments on commit ed50e15

Please sign in to comment.