feat(home-manager): add nixgl

This commit is contained in:
Yorick Barbanneau 2024-08-30 21:22:02 +02:00
parent cf8a838191
commit 3d36ef0261
4 changed files with 76 additions and 16 deletions

37
flake.lock generated
View file

@ -1,5 +1,20 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -20,6 +35,27 @@
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1713543440,
"narHash": "sha256-lnzZQYG0+EXl/6NkGpyIz+FEOc/DSEG57AP1VsdeNrM=",
"owner": "nix-community",
"repo": "nixGL",
"rev": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixGL",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1723362943,
@ -53,6 +89,7 @@
"root": {
"inputs": {
"home-manager": "home-manager",
"nixgl": "nixgl",
"nixpkgs": "nixpkgs",
"nur": "nur"
}

View file

@ -3,12 +3,16 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, nur, ... }@inputs:
outputs = { self, nixpkgs, home-manager, nur, nixgl, ... }@inputs:
let
stateVersion = "23.11";
@ -82,7 +86,10 @@ in {
};
homeConfigurations = {
rick = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.aarch64-linux;
pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [ nixgl.overlay ];
};
extraSpecialArgs = {
inherit stateVersion inputs;
hostname = "rick";

View file

@ -25,7 +25,7 @@
};
web.firefox = {
enable = true;
installPackage = false;
enableNixGL = true;
};
web.qutebrowser.enable = false;
web.webcord.enable = false;

View file

@ -8,10 +8,10 @@ in
options.modules.web.firefox = {
enable = mkEnableOption "enable Firefox web browser";
installPackage = mkOption {
enableNixGL = mkOption {
type = types.bool;
default = true;
description = "install Package, if false relies on distribution packages";
default = false;
description = "Use NixGL to start Firefox";
};
};
config = mkIf cfg.enable {
@ -26,18 +26,34 @@ in
"x-scheme-handler/about" = "firefox.desktop";
"x-scheme-handler/unknown" = "firefox.desktop";
};
xdg.desktopEntries."firefox" = if cfg.enableNixGL then {
name = "Firefox NixGL Powered";
exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa firefox %U";
icon = "firefox";
terminal = false;
type = "Application";
startupNotify = true;
actions = {
"new-private-window" = {
exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa firefox --private-window %U";
name = "New Private Window";
};
"new-window" = {
exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa firefox --new-window %U";
name = "New Window";
};
};
}
else {};
programs.firefox = {
enable = true;
package =
if cfg.installPackage
then pkgs.wrapFirefox pkgs.firefox-unwrapped {
nativeMessagingHosts = [
# Tridactyl native connector
pkgs.tridactyl-native
pkgs.browserpass
];
}
else null;
package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
nativeMessagingHosts = [
# Tridactyl native connector
pkgs.tridactyl-native
pkgs.browserpass
];
};
profiles.ephase = {
id = 0;
name = "ephase";