From 600f45aa75b2fe8a4b5cfd3eb07a17c3842b4c8b Mon Sep 17 00:00:00 2001 From: Natasha Moongrave Date: Sat, 4 Apr 2026 22:57:45 +0200 Subject: Add rice-driven desktop environment system - Created rice-desktop.nix module allowing rices to declare desktop environments - Supports i3, KDE Plasma, or no desktop environment - Enables rice-specific stylix overrides and wallpapers - Moved desktop and stylix configuration from separate modules to unified rice-desktop - Updated system/default.nix to import rice-desktop instead of desktop.nix and stylix.nix --- system/default.nix | 3 +- system/rice-desktop.nix | 193 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 system/rice-desktop.nix (limited to 'system') diff --git a/system/default.nix b/system/default.nix index 638ae02..0ce312c 100644 --- a/system/default.nix +++ b/system/default.nix @@ -10,8 +10,7 @@ ./programs.nix ./services.nix ./users.nix - ./desktop.nix - ./stylix.nix + ./rice-desktop.nix ]; system.stateVersion = "25.11"; diff --git a/system/rice-desktop.nix b/system/rice-desktop.nix new file mode 100644 index 0000000..78a63e9 --- /dev/null +++ b/system/rice-desktop.nix @@ -0,0 +1,193 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.rice; +in { + options.rice = { + desktop = { + environment = lib.mkOption { + type = lib.types.enum ["i3" "plasma" "none"]; + default = "i3"; + description = "Desktop environment to use"; + }; + + wayland.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enable Wayland support"; + }; + + compositor.enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Enable picom compositor (for X11 environments)"; + }; + }; + + stylix = { + overrideColors = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Override system stylix colors with rice-specific colors"; + }; + + base16Scheme = lib.mkOption { + type = lib.types.nullOr lib.types.attrs; + default = null; + description = "Custom Base16 color scheme"; + }; + + wallpaper = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + description = "Custom wallpaper path or derivation"; + }; + + fonts = lib.mkOption { + type = lib.types.nullOr lib.types.attrs; + default = null; + description = "Custom font configuration"; + }; + }; + }; + + config = lib.mkMerge [ + # Default stylix configuration (can be overridden by rices) + { + stylix = { + enable = true; + autoEnable = true; + + # Default Base16 scheme - Nord Blue inspired + base16Scheme = lib.mkDefault { + base00 = "2D333F"; # background + base01 = "3B4252"; # lighter background + base02 = "434C5E"; # selection background + base03 = "4C566A"; # comments + base04 = "D8DEE9"; # dark foreground + base05 = "C6D0F5"; # foreground + base06 = "E5E9F0"; # light foreground + base07 = "ECEFF4"; # lightest foreground + base08 = "BF616A"; # red + base09 = "D5A18E"; # orange/tan + base0A = "EBCB8B"; # yellow + base0B = "A3BE8C"; # green + base0C = "88C0D0"; # cyan + base0D = "82A3C0"; # blue (accent) + base0E = "B48EAD"; # purple + base0F = "5E81AC"; # dark blue + }; + + # Default wallpaper + image = lib.mkDefault (pkgs.fetchurl { + url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/wallpapers/nix-wallpaper-simple-blue.png"; + sha256 = "sha256-utrcjzfeJoFOpUbFY2eIUNCKy5rjLt57xIoUUssJmdI="; + }); + + # Default fonts + fonts = lib.mkDefault { + monospace = { + package = pkgs.nerd-fonts.jetbrains-mono; + name = "JetBrainsMono Nerd Font"; + }; + sansSerif = { + package = pkgs.noto-fonts; + name = "Noto Sans"; + }; + serif = { + package = pkgs.noto-fonts; + name = "Noto Serif"; + }; + emoji = { + package = pkgs.noto-fonts-color-emoji; + name = "Noto Color Emoji"; + }; + sizes = { + terminal = 10; + applications = 11; + desktop = 11; + }; + }; + + # Default cursor + cursor = lib.mkDefault { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Classic"; + size = 24; + }; + + # Default opacity + opacity = lib.mkDefault { + terminal = 0.95; + applications = 1.0; + desktop = 1.0; + popups = 0.95; + }; + + # Default polarity + polarity = lib.mkDefault "dark"; + + # Disable nixos-icons to avoid conflict + targets.nixos-icons.enable = false; + }; + } + + # Rice-specific stylix overrides + (lib.mkIf cfg.stylix.overrideColors { + stylix = { + base16Scheme = lib.mkIf (cfg.stylix.base16Scheme != null) (lib.mkForce cfg.stylix.base16Scheme); + image = lib.mkIf (cfg.stylix.wallpaper != null) (lib.mkForce cfg.stylix.wallpaper); + fonts = lib.mkIf (cfg.stylix.fonts != null) (lib.mkForce cfg.stylix.fonts); + }; + }) + + # i3 desktop environment + (lib.mkIf (cfg.desktop.environment == "i3") { + services.xserver = { + enable = true; + windowManager.i3.enable = true; + + # Czech QWERTZ layout + xkb = { + layout = "cz"; + options = "eurosign:e,caps:escape"; + }; + }; + + # Compositor for X11 + services.picom.enable = cfg.desktop.compositor.enable; + }) + + # KDE Plasma desktop environment + (lib.mkIf (cfg.desktop.environment == "plasma") { + # Enable KDE Plasma 6 + services.displayManager.sddm = { + enable = true; + wayland.enable = cfg.desktop.wayland.enable; + }; + + services.desktopManager.plasma6.enable = true; + + # X11 configuration for Plasma (if not using Wayland) + services.xserver = { + enable = true; + xkb = { + layout = "cz"; + options = "eurosign:e,caps:escape"; + }; + }; + + # KDE-specific packages + environment.systemPackages = with pkgs; [ + kdePackages.kate + kdePackages.konsole + kdePackages.dolphin + kdePackages.spectacle + kdePackages.gwenview + ]; + }) + ]; +} -- cgit v1.2.3