From 7798d01caecc360c15ab13321ea09d9aa1402d68 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 18 Sep 2024 12:44:14 -0400 Subject: [PATCH] add gnome modules (#108) * firefox: add gnome browser connector * lavaridge: remove commented gnome settings * nixos: add gnome module * nix fmt * vscode: use custom titlebar on gnome * theme: check for gnome before adding extraCss * firefox: browsers in titlebar when gnome is enabled * home: add gnome settings * desktop: set gtk window decorations * gnome: remove gsconnect * Merge branch 'master' into add-gnome --- homeManagerModules/apps/firefox/default.nix | 3 +- homeManagerModules/apps/vsCodium/default.nix | 7 +- homeManagerModules/desktop/default.nix | 7 ++ homeManagerModules/desktop/gnome/default.nix | 65 ++++++++++++++++++ .../desktop/wayland/default.nix | 8 --- homeManagerModules/options.nix | 6 ++ homeManagerModules/theme.nix | 6 +- hosts/lavaridge/default.nix | 3 - nixosModules/apps/firefox/default.nix | 7 +- nixosModules/desktop/default.nix | 4 +- nixosModules/desktop/gnome/default.nix | 66 +++++++++++++++++++ nixosModules/options.nix | 1 + 12 files changed, 165 insertions(+), 18 deletions(-) create mode 100644 homeManagerModules/desktop/gnome/default.nix create mode 100644 nixosModules/desktop/gnome/default.nix diff --git a/homeManagerModules/apps/firefox/default.nix b/homeManagerModules/apps/firefox/default.nix index d6c86882..8c041860 100644 --- a/homeManagerModules/apps/firefox/default.nix +++ b/homeManagerModules/apps/firefox/default.nix @@ -8,7 +8,8 @@ programs.firefox = { enable = true; nativeMessagingHosts = - lib.optional (config.ar.home.apps.keepassxc.enable) pkgs.keepassxc; + lib.optionals (config.ar.home.desktop.gnome.enable) [pkgs.gnome-browser-connector] + ++ lib.optional (config.ar.home.apps.keepassxc.enable) pkgs.keepassxc; }; }; } diff --git a/homeManagerModules/apps/vsCodium/default.nix b/homeManagerModules/apps/vsCodium/default.nix index 232a2b4c..1091cab7 100644 --- a/homeManagerModules/apps/vsCodium/default.nix +++ b/homeManagerModules/apps/vsCodium/default.nix @@ -80,7 +80,12 @@ in { "terminal.integrated.fontSize" = config.stylix.fonts.sizes.terminal + 3; "update.mode" = "none"; "window.menuBarVisibility" = "hidden"; - "window.titleBarStyle" = lib.mkDefault "native"; + + "window.titleBarStyle" = + if config.ar.home.desktop.gnome.enable + then "custom" + else "native"; + "window.zoomPerWindow" = false; }; diff --git a/homeManagerModules/desktop/default.nix b/homeManagerModules/desktop/default.nix index 5ef7d91d..af03c67a 100644 --- a/homeManagerModules/desktop/default.nix +++ b/homeManagerModules/desktop/default.nix @@ -6,6 +6,7 @@ ... }: { imports = [ + ./gnome ./hyprland ./sway ./wayland @@ -19,6 +20,12 @@ dconf = { enable = true; settings = { + "org/gnome/desktop/wm/preferences".button-layout = + if config.ar.home.desktop.gnome.enable + then "appmenu:minimize,maximize,close" + else ""; + + "org/gnome/nm-applet".disable-connected-notifications = true; "org/gtk/gtk4/settings/file-chooser".sort-directories-first = true; "org/gtk/settings/file-chooser".sort-directories-first = true; diff --git a/homeManagerModules/desktop/gnome/default.nix b/homeManagerModules/desktop/gnome/default.nix new file mode 100644 index 00000000..6c837d74 --- /dev/null +++ b/homeManagerModules/desktop/gnome/default.nix @@ -0,0 +1,65 @@ +{ + config, + lib, + pkgs, + ... +}: { + config = lib.mkIf config.ar.home.desktop.gnome.enable { + dconf = { + enable = true; + + settings = { + "org/gnome/desktop/datetime".automatic-timezone = true; + + "org/gnome/desktop/interface" = { + clock-format = "12h"; + enable-hot-corners = true; + }; + + "org/gnome/desktop/peripherals/touchpad".tap-to-click = true; + "org/gnome/desktop/search-providers".enabled = "['org.gnome.Calendar.desktop', 'org.gnome.Weather.desktop', 'org.gnome.Contacts.desktop', 'org.gnome.Calculator.desktop', 'org.gnome.Characters.desktop', 'org.gnome.clocks.desktop']"; + "org/gnome/desktop/wm/preferences".auto-raise = true; + + "org/gnome/mutter" = { + dynamic-workspaces = true; + edge-tiling = true; + workspaces-only-on-primary = true; + }; + + "org/gnome/shell".enabled-extensions = [ + "appindicatorsupport@rgcjonas.gmail.com" + "blur-my-shell@aunetx" + "noannoyance-fork@vrba.dev" + "tailscale-status@maxgallup.github.com" + "tiling-assistant@leleat-on-github" + "drive-menu@gnome-shell-extensions.gcampax.github.com" + ]; + + "org/gnome/shell/extensions/blur-my-shell/overview".style-components = 3; + + "org/gnome/shell/extensions/blur-my-shell/panel" = { + blur = false; + customize = true; + override-background = false; + override-background-dynamically = false; + style-panel = 0; + unblur-in-overview = true; + }; + + "org/gnome/system/location".enabled = true; + }; + }; + + programs.gnome-shell = { + enable = true; + + extensions = [ + {package = pkgs.gnomeExtensions.appindicator;} + {package = pkgs.gnomeExtensions.blur-my-shell;} + {package = pkgs.gnomeExtensions.noannoyance-fork;} + {package = pkgs.gnomeExtensions.tailscale-status;} + {package = pkgs.gnomeExtensions.tiling-assistant;} + ]; + }; + }; +} diff --git a/homeManagerModules/desktop/wayland/default.nix b/homeManagerModules/desktop/wayland/default.nix index 4d5c6473..f5c95646 100644 --- a/homeManagerModules/desktop/wayland/default.nix +++ b/homeManagerModules/desktop/wayland/default.nix @@ -21,14 +21,6 @@ }; }; - dconf = { - enable = true; - settings = { - "org/gnome/desktop/wm/preferences".button-layout = ""; - "org/gnome/nm-applet".disable-connected-notifications = true; - }; - }; - home.packages = with pkgs; [ blueberry gnome.file-roller diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index f8eaf7de..ba1c021e 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -95,6 +95,12 @@ in { type = lib.types.bool; }; + gnome.enable = lib.mkOption { + description = "GNOME with sane defaults."; + default = osConfig.ar.desktop.gnome.enable; + type = lib.types.bool; + }; + hyprland = { enable = lib.mkOption { description = "Hyprland with full desktop session components."; diff --git a/homeManagerModules/theme.nix b/homeManagerModules/theme.nix index dcc25943..5ee9e912 100644 --- a/homeManagerModules/theme.nix +++ b/homeManagerModules/theme.nix @@ -36,7 +36,7 @@ in { }; stylix.targets.gtk.extraCss = builtins.concatStringsSep "\n" [ - (lib.optionalString (cfg.desktop.hyprland.enable || cfg.desktop.sway.enable) '' + (lib.optionalString ((cfg.desktop.hyprland.enable || cfg.desktop.sway.enable) && !cfg.desktop.gnome.enable) '' window.background { border-radius: ${toString cfg.theme.borders.radius}; } tooltip { @@ -52,14 +52,14 @@ in { }'') (lib.optionalString ( - (cfg.desktop.hyprland.enable || cfg.desktop.sway.enable) && (config.stylix.polarity == "light") + (cfg.desktop.hyprland.enable || cfg.desktop.sway.enable) && (config.stylix.polarity == "light") && !cfg.desktop.gnome.enable ) '' tooltip { &.background { background-color: alpha(${config.lib.stylix.colors.withHashtag.base05}, ${builtins.toString config.stylix.opacity.popups}); } background-color: alpha(${config.lib.stylix.colors.withHashtag.base05}, ${builtins.toString config.stylix.opacity.popups}); }'') - (lib.optionalString cfg.theme.gtk.hideTitleBar '' + (lib.optionalString (cfg.theme.gtk.hideTitleBar && !cfg.desktop.gnome.enable) '' /* No (default) title bar on wayland */ headerbar.default-decoration { /* You may need to tweak these values depending on your GTK theme */ diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 3abeacf1..a5d644a4 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -39,9 +39,6 @@ environment.variables.GDK_SCALE = "2"; networking.hostName = "lavaridge"; programs.firefox.policies.Preferences."media.ffmpeg.vaapi.enabled" = lib.mkForce false; - # services.xserver.enable = true; - # services.xserver.displayManager.gdm.enable = true; - # services.xserver.desktopManager.gnome.enable = true; system.stateVersion = "24.05"; ar = { diff --git a/nixosModules/apps/firefox/default.nix b/nixosModules/apps/firefox/default.nix index 0998dacc..dc790fde 100644 --- a/nixosModules/apps/firefox/default.nix +++ b/nixosModules/apps/firefox/default.nix @@ -76,7 +76,12 @@ Preferences = { "browser.aboutConfig.showWarning" = false; "browser.bookmarks.addedImportButton" = false; - "browser.tabs.inTitlebar" = 0; + + "browser.tabs.inTitlebar" = + if config.ar.desktop.gnome.enable + then 1 + else 0; + "datareporting.policy.dataSubmissionPolicyAccepted" = true; "dom.security.https_only_mode" = true; "extensions.autoDisableScopes" = 0; diff --git a/nixosModules/desktop/default.nix b/nixosModules/desktop/default.nix index 9696431a..464eca44 100644 --- a/nixosModules/desktop/default.nix +++ b/nixosModules/desktop/default.nix @@ -6,6 +6,7 @@ }: { imports = [ ./greetd + ./gnome ./hyprland ./sway ./waylandComp.nix @@ -13,7 +14,8 @@ config = lib.mkIf ( - config.ar.desktop.hyprland.enable + config.ar.desktop.gnome.enable + || config.ar.desktop.hyprland.enable || config.ar.desktop.steam.enable || config.ar.desktop.sway.enable ) { diff --git a/nixosModules/desktop/gnome/default.nix b/nixosModules/desktop/gnome/default.nix new file mode 100644 index 00000000..0262fff4 --- /dev/null +++ b/nixosModules/desktop/gnome/default.nix @@ -0,0 +1,66 @@ +{ + config, + lib, + pkgs, + ... +}: { + config = lib.mkIf config.ar.desktop.gnome.enable { + # nixpkgs.overlays = [ + # # GNOME 46: triple-buffering-v4-46 + # (final: prev: { + # gnome = prev.gnome.overrideScope (gnomeFinal: gnomePrev: { + # mutter = gnomePrev.mutter.overrideAttrs (old: { + # src = pkgs.fetchFromGitLab { + # domain = "gitlab.gnome.org"; + # owner = "vanvugt"; + # repo = "mutter"; + # rev = "triple-buffering-v4-46"; + # hash = "sha256-nz1Enw1NjxLEF3JUG0qknJgf4328W/VvdMjJmoOEMYs="; + # }; + # }); + # }); + # }) + # ]; + + security.pam.services = { + login.fprintAuth = false; + + gdm = { + enableGnomeKeyring = true; + gnupg.enable = true; + kwallet.enable = true; + }; + + gdm-fingerprint = lib.mkIf (config.services.fprintd.enable) { + text = '' + auth required pam_shells.so + auth requisite pam_nologin.so + auth requisite pam_faillock.so preauth + auth required ${pkgs.fprintd}/lib/security/pam_fprintd.so + auth optional pam_permit.so + auth required pam_env.so + auth [success=ok default=1] ${pkgs.gnome.gdm}/lib/security/pam_gdm.so + auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so + + account include login + + password required pam_deny.so + + session include login + session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start + ''; + }; + }; + + # Enable GNOME and GDM. + services = { + gnome.tracker-miners.enable = true; + udev.packages = with pkgs; [gnome.gnome-settings-daemon]; + + xserver = { + desktopManager.gnome.enable = true; + displayManager.gdm.enable = true; + }; + }; + }; +} diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 61cf0b90..0959db3d 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -29,6 +29,7 @@ }; }; + gnome.enable = lib.mkEnableOption "GNOME desktop session."; hyprland.enable = lib.mkEnableOption "Hyprland wayland session."; steam.enable = lib.mkEnableOption "Steam + Gamescope session."; sway.enable = lib.mkEnableOption "Sway wayland session.";