From 652b1f3dd380f6f6515450b46a02d4accbe2c436 Mon Sep 17 00:00:00 2001 From: Zoty Date: Sat, 28 Mar 2026 03:28:42 -0300 Subject: [PATCH] feat: configure desktop --- modules/_home/cursor.nix | 13 ++++++++++ modules/_home/default.nix | 11 ++++++++- modules/_home/dolphin.nix | 20 +++++++++++++++ modules/_home/mako.nix | 5 ++++ modules/_home/niri.nix | 51 ++++++++++++++++++++++++++++++++++++++- modules/_home/theme.nix | 34 ++++++++++++++++++++++++++ modules/core.nix | 26 +++++++++++++------- modules/den.nix | 4 +++ modules/niri.nix | 12 ++++++--- modules/services.nix | 40 ++++++++++++++++++++++++++++++ 10 files changed, 201 insertions(+), 15 deletions(-) create mode 100644 modules/_home/cursor.nix create mode 100644 modules/_home/dolphin.nix create mode 100644 modules/_home/mako.nix create mode 100644 modules/_home/theme.nix create mode 100644 modules/services.nix diff --git a/modules/_home/cursor.nix b/modules/_home/cursor.nix new file mode 100644 index 0000000..1f638db --- /dev/null +++ b/modules/_home/cursor.nix @@ -0,0 +1,13 @@ +{ pkgs, ...}: { + home.pointerCursor = { + gtk.enable = true; + name = "Bibata-Modern-Ice"; + package = pkgs.bibata-cursors; + size = 24; + }; + + home.sessionVariables = { + XCURSOR_THEME = "Bibata-Modern-Ice"; + XCURSOR_SIZE = 24; + }; +} diff --git a/modules/_home/default.nix b/modules/_home/default.nix index 3905f63..e0f63a7 100644 --- a/modules/_home/default.nix +++ b/modules/_home/default.nix @@ -4,6 +4,15 @@ discord ]; + home.sessionVariables = { + TERMINAL = "wezterm"; + XDG_TERMINAL_EMULATOR = "wezterm"; + }; + + systemd.user.targets.niri-session = { + Unit.Wants = [ "xdg-desktop-autostart.target" ]; + }; + programs.git = { enable = true; userName = "Zoty"; @@ -36,7 +45,7 @@ "history" ]; }; - }; + }; programs.direnv = { enable = true; diff --git a/modules/_home/dolphin.nix b/modules/_home/dolphin.nix new file mode 100644 index 0000000..21f9cee --- /dev/null +++ b/modules/_home/dolphin.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ + kdePackages.dolphin + kdePackages.qtwayland + kdePackages.kio + kdePackages.kio-fuse + kdePackages.kio-extras + kdePackages.ark + kdePackages.ffmpegthumbs + kdePackages.kded + kdePackages.systemsettings + ffmpegthumbnailer + ]; + + xdg.configFile."xdg-desktop-portal/niri-portals.conf".text = '' + [preferred] + default=gnome; + org.freedesktop.impl.portal.FileChooser=kde; + ''; +} diff --git a/modules/_home/mako.nix b/modules/_home/mako.nix new file mode 100644 index 0000000..a5a2c00 --- /dev/null +++ b/modules/_home/mako.nix @@ -0,0 +1,5 @@ +{ ... }: { + services.mako = { + enable = true; + }; +} diff --git a/modules/_home/niri.nix b/modules/_home/niri.nix index 622b456..f82c5e7 100644 --- a/modules/_home/niri.nix +++ b/modules/_home/niri.nix @@ -1,4 +1,53 @@ { pkgs, ... }: { + home.sessionVariables = { + XDG_SESSION_TYPE = "wayland"; + XDG_CURRENT_DESKTOP = "niri"; + XDG_SESSION_DESKTOP = "niri"; + QT_QPA_PLATFORM = "wayland;xcb"; + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + QT_ENABLE_HIGHDPI_SCALING = "1"; + QT_SCALE_FACTOR_ROUNDING_POLICY = "RoundPreferFloor"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + XDG_MENU_PREFIX = "plasma-"; + }; + + systemd.user.services.niri-env-import = { + Unit = { + Description = "Import Niri Wayland environment into systemd and D-Bus"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + Service = { + Type = "oneshot"; + ExecStart = pkgs.writeShellScript "niri-env-import" '' + ${pkgs.dbus}/bin/dbus-update-activation-environment --systemd \ + WAYLAND_DISPLAY \ + XDG_CURRENT_DESKTOP \ + XDG_SESSION_DESKTOP \ + QT_QPA_PLATFORM + ''; + RemainAfterExit = true; + }; + Install.WantedBy = [ "graphical-session.target" ]; + }; + + systemd.user.services.niri-flake-polkit = { + Unit.After = [ "niri-env-import.service" ]; + }; + + systemd.user.services.xwayland-satellite = { + Unit = { + Description = "Xwayland satellite"; + After = [ "graphical-session.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${pkgs.xwayland-satellite}/bin/xwayland-satellite"; + Restart = "on-failure"; + }; + Install.WantedBy = [ "graphical-session.target" ]; + }; + xdg.configFile."niri/config.kdl".text = '' // Modificadores: Mod = Super (tecla Windows) input { @@ -68,6 +117,6 @@ // Screenshot Print { screenshot; } Mod+Print { screenshot-screen; } - } + } ''; } diff --git a/modules/_home/theme.nix b/modules/_home/theme.nix new file mode 100644 index 0000000..e26b512 --- /dev/null +++ b/modules/_home/theme.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ + gruvterial-theme + gruvbox-plus-icons + libsForQt5.qt5ct + kdePackages.qt6ct + ]; + + gtk = { + enable = true; + theme = { + name = "Gruvterial-Dark"; + package = pkgs.gruvterial-theme; + }; + iconTheme = { + name = "Gruvbox-Plus-Dark"; + package = pkgs.gruvbox-plus-icons; + }; + cursorTheme = { + name = "Bibata-Modern-Ice"; + package = pkgs.bibata-cursors; + size = 24; + }; + }; + + qt = { + enable = true; + platformTheme.name = "gtk"; + style = { + name = "kvantum"; + package = pkgs.kdePackages.qtstyleplugin-kvantum; + }; + }; +} diff --git a/modules/core.nix b/modules/core.nix index 1e6f03f..34d834c 100644 --- a/modules/core.nix +++ b/modules/core.nix @@ -15,7 +15,10 @@ }; }; - services.xserver.xkb.layout = "us"; + services.xserver = { + enable = false; + layout = "en"; + }; environment.systemPackages = with pkgs; [ curl @@ -23,17 +26,22 @@ neovim btop nixd - ]; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; + ]; networking.networkmanager.enable = true; time.timeZone = "America/Sao_Paulo"; i18n.defaultLocale = "en_US.UTF-8"; + + services.dbus.enable = true; + programs.dconf.enable = true; + + environment.sessionVariables = { + XDG_SESSION_TYPE = "wayland"; + CLUTTER_BACKEND = "wayland"; + SDL_VIDEODRIVER = "wayland"; + MOZ_ENABLE_WAYLAND = "1"; + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; + EDITOR = "nvim"; + }; }; } diff --git a/modules/den.nix b/modules/den.nix index a5e2351..fc75163 100644 --- a/modules/den.nix +++ b/modules/den.nix @@ -65,8 +65,12 @@ imports = [ ./_home/default.nix ./_home/niri.nix + ./_home/cursor.nix ./_home/git.nix ./_home/wezterm.nix + ./_home/mako.nix + ./_home/dolphin.nix + ./_home/theme.nix ]; }; }; diff --git a/modules/niri.nix b/modules/niri.nix index 38d41cf..995a160 100644 --- a/modules/niri.nix +++ b/modules/niri.nix @@ -15,13 +15,17 @@ grim slurp wl-clipboard - mako xdg-desktop-portal-gnome - ]; - + kdePackages.xdg-desktop-portal-kde + xwayland-satellite + ]; + xdg.portal = { enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gnome ]; + extraPortals = [ + pkgs.xdg-desktop-portal-gnome + pkgs.kdePackages.xdg-desktop-portal-kde + ]; }; security.pam.services.swaylock = {}; diff --git a/modules/services.nix b/modules/services.nix new file mode 100644 index 0000000..7ca5f8f --- /dev/null +++ b/modules/services.nix @@ -0,0 +1,40 @@ +{ den, ... }: { + den.aspects.core.nixos = { pkgs, ... }: { + services = { + libinput.enable = true; + fstrim.enable = true; + gvfs.enable = true; + dbus.implementation = "broker"; + + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + extraConfig.pipewire."92-low-latency" = { + "content.properties" = { + "default.clock.rate" = 48000; + "default.clock.quantum" = 256; + "default.clock.min-quantum" = 256; + "default.clock.max-quantum" = 256; + }; + }; + extraConfig.pipewire-pulse."92-low-latency" = { + context.modules = [ + { + name = "libpipewire-module-protocol-pulse"; + args = { + pulse.min.req = "256/48000"; + pulse.default.req = "256/48000"; + pulse.max.req = "256/48000"; + pulse.min.quantum = "256/48000"; + pulse.max.quantum = "256/48000"; + }; + } + ]; + }; + }; + }; + }; +}