diff options
author | Leonardo Santiago <[email protected]> | 2025-05-08 00:48:42 -0300 |
---|---|---|
committer | Leonardo Santiago <[email protected]> | 2025-05-08 00:48:42 -0300 |
commit | dab1895180c9554abc2ca60d00e106bee393f640 (patch) | |
tree | 77f3f3e0729afcc7a1eb2d6011b84790f7303996 | |
parent | cd2a8d670aa8dbcc9be199797315e6a45adc1279 (diff) |
chore(gnome): rewrite extension logic to be able to more easily enable them separately
-rw-r--r-- | hosts/larissa.nix | 5 | ||||
-rw-r--r-- | modules/basic.nix | 16 | ||||
-rw-r--r-- | modules/gnome/default.nix | 84 | ||||
-rw-r--r-- | modules/gnome/extensions.nix | 33 | ||||
-rw-r--r-- | modules/gnome/gnome-config.nix | 65 |
5 files changed, 117 insertions, 86 deletions
diff --git a/hosts/larissa.nix b/hosts/larissa.nix index b400f53..9cb81af 100644 --- a/hosts/larissa.nix +++ b/hosts/larissa.nix @@ -9,7 +9,10 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - santi-modules.desktop-environment.enable = true; + santi-modules = { + desktop-environment.enable = true; + has-touchpad = true; + }; # Bootloader. boot = { loader.systemd-boot.enable = true; diff --git a/modules/basic.nix b/modules/basic.nix index 216ce81..39e50fb 100644 --- a/modules/basic.nix +++ b/modules/basic.nix @@ -1,10 +1,18 @@ { config, lib, pkgs, inputs, ...}: with lib; { - options.santi-modules.basic.enable = mkOption { - type = types.bool; - default = true; - description = "Enables basic configuration on nix, nixpkgs and bash prompt."; + options.santi-modules = { + basic.enable = mkOption { + type = types.bool; + default = true; + description = "Enables basic configuration on nix, nixpkgs and bash prompt."; + }; + has-touchpad = mkOption { + type = types.bool; + default = false; + description = "Whether a given device has support for touchpad"; + }; }; config = mkIf config.santi-modules.basic.enable { + documentation.nixos.enable = false; nix = { registry.nixpkgs.to = { type = "path"; diff --git a/modules/gnome/default.nix b/modules/gnome/default.nix index 8cf11c5..4422eef 100644 --- a/modules/gnome/default.nix +++ b/modules/gnome/default.nix @@ -1,27 +1,44 @@ { config, lib, pkgs, ...}: with lib; { imports = [ - ./gnome-config.nix + ./extensions.nix ]; - options.santi-modules.gnome.enable = mkEnableOption "Enable gnome"; + options.santi-modules.gnome = { + enable = mkEnableOption "Enable gnome"; + extensions = mkOption { + description = "Extensions to gnome"; + type = with types; attrsOf (submodule { + options = { + package = mkOption { + type = package; + description = "Extension package"; + }; + email = mkOption { + type = str; + description = "Extensions' maintainer email"; + }; + dconf-settings = mkOption { + type = attrs; + default = {}; + description = "Extra configuration to be passed to dconf"; + }; + enabled = mkEnableOption { + description = "Enable extension"; + }; + }; + }); + }; + }; config = mkIf config.santi-modules.gnome.enable { programs.dconf.enable = true; - environment.systemPackages = with pkgs; [ - gnome-tweaks - tela-icon-theme - hackneyed - ] ++ (with gnomeExtensions; [ - appindicator - vitals - user-themes - graphite-gtk-theme - x11-gestures - gsconnect - openweather-refined - ]); - environment.gnome.excludePackages = with pkgs; [ + gnome-font-viewer + gnome-connections + simple-scan + gnome-contacts gnome-photos gnome-tour + gnome-notes + gnome-text-editor gedit cheese gnome-terminal @@ -42,11 +59,46 @@ wayland = true; }; desktopManager.gnome.enable = true; + excludePackages = [ pkgs.xterm ]; }; services.udev.packages = [ pkgs.gnome-settings-daemon ]; services.gnome = { gnome-browser-connector.enable = true; gnome-keyring.enable = true; }; + home-manager.users.leonardo.dconf.settings = { + "org/gnome/desktop/background" = { + picture-uri = "${../../wallpaper.png}"; + picture-uri-dark = "${../../wallpaper.png}"; + picture-options = "zoom"; + }; + "org/gnome/desktop/interface" = { + color-scheme="prefer-dark"; + enable-hot-corners=false; + font-antialiasing="grayscale"; + font-hinting="slight"; + gtk-theme="Adwaita"; + cursor-theme="Hackneyed"; + icon-theme="Tela-brown-light"; + show-battery-percentage=true; + }; + "org/gnome/settings-daemon/plugins/power" = { + power-button-action="hibernate"; + sleep-inactive-ac-type="nothing"; + }; + "org/gnome/mutter" = { + dynamic-workspaces= true; + edge-tiling= true; + workspaces-only-on-primary= true; + experimental-features = [ "scale-monitor-framebuffer" "variable-refresh-rate"]; + }; + "org/gnome/shell" = { + disabled-extensions= [ + ]; + }; + "org/gnome/shell/app-switcher".current-workspace-only = true; + }; }; } diff --git a/modules/gnome/extensions.nix b/modules/gnome/extensions.nix new file mode 100644 index 0000000..1127359 --- /dev/null +++ b/modules/gnome/extensions.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... } : let + inherit (builtins) attrNames attrValues; + cfg = config.santi-modules.gnome; + enabled-extensions = lib.filterAttrs (key: conf: conf.enabled) cfg.extensions; +in { + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + gnome-tweaks + tela-icon-theme + hackneyed + ] ++ map (pkg-name: pkgs.gnomeExtensions.${pkg-name}) + (attrNames enabled-extensions); + santi-modules.gnome.extensions = { + appindicator = { + email = "[email protected]"; + enabled = true; + }; + x11-gestures = { + email = "[email protected]"; + enabled = config.santi-modules.has-touchpad; + }; + system-monitor = { + email = "[email protected]"; + enabled = true; + }; + }; + home-manager.users.leonardo.dconf.settings = lib.mkMerge ([{ + "org/gnome/shell" = { + enabled-extensions = map (pkg: pkg.email) (attrValues enabled-extensions); + }; + }] ++ (map (pkg: pkg.dconf-settings) (attrValues enabled-extensions))); + }; +} diff --git a/modules/gnome/gnome-config.nix b/modules/gnome/gnome-config.nix deleted file mode 100644 index ff401c4..0000000 --- a/modules/gnome/gnome-config.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ config, lib, ... }: lib.mkIf config.santi-modules.gnome.enable { - home-manager.users.leonardo.dconf.settings = { - "org/gnome/desktop/background" = { - picture-uri = "${../../wallpaper.png}"; - picture-uri-dark = "${../../wallpaper.png}"; - picture-options = "zoom"; - }; - "org/gnome/desktop/interface" = { - color-scheme="prefer-dark"; - enable-hot-corners=false; - font-antialiasing="grayscale"; - font-hinting="slight"; - gtk-theme="Adwaita"; - cursor-theme="Hackneyed"; - icon-theme="Tela-brown-light"; - show-battery-percentage=true; - }; - "org/gnome/desktop/peripherals/touchpad" = { - edge-scrolling-enabled=false; - natural-scroll=true; - tap-to-click=true; - two-finger-scrolling-enabled=true; - }; - "org/gnome/mutter" = { - dynamic-workspaces= true; - edge-tiling= true; - workspaces-only-on-primary= true; - experimental-features = [ "scale-monitor-framebuffer" "variable-refresh-rate"]; - }; - "org/gnome/settings-daemon/plugins/power" = { - power-button-action="hibernate"; - sleep-inactive-ac-type="nothing"; - }; - # ========= GNOME SHELL ============ - "org/gnome/shell" = { - enabled-extensions = [ - ]; - disabled-extensions= [ - ]; - }; - "org/gnome/shell/extensions/user-theme".name = "Graphite"; - "org/gnome/shell/app-switcher".current-workspace-only = true; - "org/gnome/shell/extensions/openbar" = { - bartype="Islands"; - apply-accent-shell= true; - apply-all-shell = false; - apply-menu-notif = true; - apply-menu-shell = true; - autotheme-dark="Dark"; - autotheme-font= true; - autotheme-light= "Light"; - autotheme-refresh= true; - color-scheme="prefer-dark"; - cust-margin-wmax=false; - margin = 0.0; - wmaxbar = true; - border-wmax = true; - }; - }; -} |