Skip to content

Commit

Permalink
home-manager/nixgl: init
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Jan 2, 2024
1 parent 9eec46c commit 88f1257
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
28 changes: 10 additions & 18 deletions home-manager/crostini.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
{ config, lib, libEx, pkgs, ... }:
{ config, lib, pkgs, ... }:

{
options.home-manager.crostini.enable = lib.mkEnableOption "Crostini (ChromeOS) config";

config = lib.mkIf config.home-manager.crostini.enable {
home.packages = with pkgs; [
nixgl.nixGLMesa
(libEx.nixGLWrapper { pkg = firefox; nixGL = nixgl.nixGLMesa; })
];

home-manager = {
# Not using the desktop.firefox here since we are wrapping it with
# nixGLWrapper, that it is incompatible with the Home-Manager
# module
desktop.mpv.enable = lib.mkDefault true;
dev.enable = lib.mkDefault true;
editor.neovim.enableLowMemory = lib.mkDefault true;
};

programs = {
mpv.package = libEx.nixGLWrapper {
pkg = pkgs.mpv;
nixGL = pkgs.nixgl.nixGLMesa;
desktop = {
firefox.enable = true;
mpv.enable = true;
nixgl = {
enable = true;
package = pkgs.nixgl.nixGLMesa;
};
};
dev.enable = true;
editor.neovim.enableLowMemory = true;
};

# https://nixos.wiki/wiki/Installing_Nix_on_Crostini
Expand Down
1 change: 1 addition & 0 deletions home-manager/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
./i3
./kitty.nix
./mpv
./nixgl.nix
./sway
./theme
./twenty-twenty-twenty.nix
Expand Down
31 changes: 31 additions & 0 deletions home-manager/desktop/nixgl.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ config, lib, libEx, pkgs, ... }:

let
cfg = config.home-manager.desktop.nixgl;
in
{
options.home-manager.desktop.nixgl = {
enable = lib.mkEnableOption "nixGL config" // {
default = config.targets.genericLinux.enable;
};
package = lib.mkPackageOption pkgs [ "nixgl" "auto" "nixGLDefault" ] { };
};

config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
cfg.package
] ++ lib.optionals config.home-manager.desktop.firefox.enable [
# This may "overwrite" some of the personalizations from the
# home-manager.desktop.firefox module, since the nixGLWrapper is
# incompatible with it and we are prioritizing the nixGL wrapped binary
(lib.hiPrio (libEx.nixGLWrapper { pkg = firefox; nixGL = cfg.package; }))
];

programs = {
mpv.package = libEx.nixGLWrapper {
pkg = pkgs.mpv;
nixGL = cfg.package;
};
};
};
}

0 comments on commit 88f1257

Please sign in to comment.