diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-11-19 21:02:52 +0100 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-11-19 21:02:52 +0100 |
| commit | 892de67a9f64d0b0cdb023d830a019d8feec0a57 (patch) | |
| tree | 0c5fd0c60ef93bb5cdc5f83c8cade0c5dddb4899 /modules/desktop | |
| parent | f5b37610b3835ea26757ef36d554ec598d53100c (diff) | |
Nix fmt
Diffstat (limited to 'modules/desktop')
| -rw-r--r-- | modules/desktop/common.nix | 66 | ||||
| -rw-r--r-- | modules/desktop/default.nix | 73 | ||||
| -rw-r--r-- | modules/desktop/steam.nix | 88 | ||||
| -rw-r--r-- | modules/desktop/wayland.nix | 14 | ||||
| -rw-r--r-- | modules/desktop/wms/default.nix | 3 | ||||
| -rw-r--r-- | modules/desktop/wms/hyprland.nix | 83 | ||||
| -rw-r--r-- | modules/desktop/wms/xfce.nix | 75 | ||||
| -rw-r--r-- | modules/desktop/x11.nix | 20 |
8 files changed, 235 insertions, 187 deletions
diff --git a/modules/desktop/common.nix b/modules/desktop/common.nix index c04a6b0..86cb562 100644 --- a/modules/desktop/common.nix +++ b/modules/desktop/common.nix @@ -1,21 +1,27 @@ -{pkgs, config, lib, ...}: { - options.addons.desktop.enable = lib.mkEnableOption "On if the machine needs a desktop"; +{ + pkgs, + config, + lib, + ... +}: +{ + options.addons.desktop.enable = lib.mkEnableOption "On if the machine needs a desktop"; - config = lib.mkIf config.addons.desktop.enable { + config = lib.mkIf config.addons.desktop.enable { programs = { - dconf.enable = true; - thunar = { - enable = true; - plugins = with pkgs.xfce; [ - thunar-archive-plugin - thunar-media-tags-plugin - thunar-volman + dconf.enable = true; + thunar = { + enable = true; + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-media-tags-plugin + thunar-volman ]; }; }; environment.systemPackages = with pkgs; [ - xdg-user-dirs + xdg-user-dirs zathura sioyek vlc @@ -28,48 +34,46 @@ # surf # A basic browser in case we don't want to import a larger browser ]; - # Enable CUPS to print documents. # services.printing.enable = true; - # Enable touchpad support (enabled default in most desktopManager). services.libinput.enable = true; - + services = { - blueman.enable = true; - # Enable sound - pipewire = { - enable = true; - pulse.enable = true; - }; + blueman.enable = true; + # Enable sound + pipewire = { + enable = true; + pulse.enable = true; + }; displayManager.sddm = { - enable=true; + enable = true; #theme = "catppuccin-mocha"; - }; + }; }; # fcitx is broken for now # i18n.inputMethod = { # type = "fcitx5"; - # enable = true; + # enable = true; # fcitx5.addons = with pkgs; [ # fcitx5-gtk # fcitx5-lua # fcitx5-mozc - # catppuccin-fcitx5 + # catppuccin-fcitx5 # fcitx5-table-other # kdePackages.fcitx5-qt - # ]; - # }; + # ]; + # }; fonts.packages = with pkgs; [ - noto-fonts - font-awesome - nerd-fonts.hurmit - minecraftia - ]; + noto-fonts + font-awesome + nerd-fonts.hurmit + minecraftia + ]; }; } diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 4719b5d..be082bc 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,50 +1,55 @@ -{pkgs, lib, config,...}: -with lib; - let - wmMeta = config.addons.desktop.wmMeta; +{ + pkgs, + lib, + config, + ... +}: +with lib; +let + wmMeta = config.addons.desktop.wmMeta; - # Gets all the vm's that are enabled and checks which protocols are used + # Gets all the vm's that are enabled and checks which protocols are used enabledWMs = (filter (wm: wm.enable) (attrValues wmMeta)); - protos = (unique (map (wm: wm.protocol) enabledWMs)); - desktopEnabled = protos != []; - x11Enabled = elem "x11" protos; - waylandEnabled = elem "wayland" protos; + protos = (unique (map (wm: wm.protocol) enabledWMs)); + desktopEnabled = protos != [ ]; + x11Enabled = elem "x11" protos; + waylandEnabled = elem "wayland" protos; - -in { +in +{ imports = [ ./common.nix ./x11.nix ./wayland.nix ./wms ./steam.nix - ]; + ]; options.addons.desktop = with types; { - wmMeta = mkOption { - type = attrsOf (submodule { - options = { - enable = mkOption { - type = bool; - default = false; - }; - protocol = mkOption { - type = str; - description = "Used display protocol (x11 or wayland)"; - }; + wmMeta = mkOption { + type = attrsOf (submodule { + options = { + enable = mkOption { + type = bool; + default = false; + }; + protocol = mkOption { + type = str; + description = "Used display protocol (x11 or wayland)"; }; - }); - default = {}; - description = "Window manager metadata used for determining which protocol to enable."; - }; + }; + }); + default = { }; + description = "Window manager metadata used for determining which protocol to enable."; + }; - # enable = lib.mkEnableOption "Whenever any desktop environment is enabled."; - # x11.enable = lib.mkEnableOption "Whenever x11 desktop environment is enabled."; - # wayland.enable = lib.mkEnableOption "Whenever wayland desktop environment is enabled."; + # enable = lib.mkEnableOption "Whenever any desktop environment is enabled."; + # x11.enable = lib.mkEnableOption "Whenever x11 desktop environment is enabled."; + # wayland.enable = lib.mkEnableOption "Whenever wayland desktop environment is enabled."; }; - config.addons.desktop = { - enable = desktopEnabled; - x11.enable = x11Enabled; - wayland.enable = waylandEnabled; + config.addons.desktop = { + enable = desktopEnabled; + x11.enable = x11Enabled; + wayland.enable = waylandEnabled; }; } diff --git a/modules/desktop/steam.nix b/modules/desktop/steam.nix index f21a5a3..a78c7c4 100644 --- a/modules/desktop/steam.nix +++ b/modules/desktop/steam.nix @@ -1,50 +1,58 @@ -{config, pkgs,lib, ...}: { +{ + config, + pkgs, + lib, + ... +}: +{ options.addons = { - steam.enable = lib.mkEnableOption "Enable steam on this machine"; + steam.enable = lib.mkEnableOption "Enable steam on this machine"; }; - config = lib.mkIf config.addons.steam.enable (lib.mkMerge [ - ({ - assertions = [ - { - assertion = config.addons.desktop.enable; - message = "You need a desktop environment to enable Steam!"; - } - ]; - programs.gamescope = { - enable = true; - capSysNice = false; # This needs to be false as to make nested steam stuff work in it. - }; - programs.steam = { - enable = true; - # Done according to the wiki, talks about some unexpected values in a lambda? - # Doesn't seem to be how overrides work - # TODO: Figure out how overrides work - # package = pkgs.steam.override { - # # withPrimus = true; - # extraPackages = with pkgs; [bumblebee glxinfo]; - # }; - - # Gamescope - gamescopeSession.enable = true; + config = lib.mkIf config.addons.steam.enable ( + lib.mkMerge [ + ({ + assertions = [ + { + assertion = config.addons.desktop.enable; + message = "You need a desktop environment to enable Steam!"; + } + ]; + programs.gamescope = { + enable = true; + capSysNice = false; # This needs to be false as to make nested steam stuff work in it. + }; + programs.steam = { + enable = true; + # Done according to the wiki, talks about some unexpected values in a lambda? + # Doesn't seem to be how overrides work + # TODO: Figure out how overrides work + # package = pkgs.steam.override { + # # withPrimus = true; + # extraPackages = with pkgs; [bumblebee glxinfo]; + # }; - # Open firewall - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - localNetworkGameTransfers.openFirewall = true; - }; + # Gamescope + gamescopeSession.enable = true; - # Enable Appimage for some steam games - programs.appimage.enable = true; - programs.appimage.binfmt = true; - }) + # Open firewall + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + }; - (lib.mkIf config.addons.dssktop.x11.enable { + # Enable Appimage for some steam games + programs.appimage.enable = true; + programs.appimage.binfmt = true; + }) - }) - (lib.mkIf config.addons.dssktop.wayland.enable { + (lib.mkIf config.addons.dssktop.x11.enable { - }) + }) + (lib.mkIf config.addons.dssktop.wayland.enable { - ]); + }) + + ] + ); } diff --git a/modules/desktop/wayland.nix b/modules/desktop/wayland.nix index d7b9651..9197a4e 100644 --- a/modules/desktop/wayland.nix +++ b/modules/desktop/wayland.nix @@ -1,12 +1,18 @@ -{pkgs, lib, config, ...}: { - options.addons.desktop.wayland.enable = lib.mkEnableOption "Enable wayland" ; +{ + pkgs, + lib, + config, + ... +}: +{ + options.addons.desktop.wayland.enable = lib.mkEnableOption "Enable wayland"; config = lib.mkIf config.addons.desktop.wayland.enable { services.displayManager.sddm.wayland.enable = true; - xdg.portal = { + xdg.portal = { enable = true; extraPortals = [ - pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-gtk ]; }; }; diff --git a/modules/desktop/wms/default.nix b/modules/desktop/wms/default.nix index 94d0e05..9f7a18d 100644 --- a/modules/desktop/wms/default.nix +++ b/modules/desktop/wms/default.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ imports = [ ./hyprland.nix ./xfce.nix diff --git a/modules/desktop/wms/hyprland.nix b/modules/desktop/wms/hyprland.nix index 8243b3d..dfc7116 100644 --- a/modules/desktop/wms/hyprland.nix +++ b/modules/desktop/wms/hyprland.nix @@ -1,43 +1,52 @@ -{pkgs, lib, config, ...}: - let cfg = config.addons.desktop.hyprland; -in { +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.addons.desktop.hyprland; +in +{ options.addons.desktop.hyprland = { - enable = lib.mkEnableOption "Enable Hyprland"; + enable = lib.mkEnableOption "Enable Hyprland"; }; - config = lib.mkIf cfg.enable (lib.mkMerge [ - (import ../../../utils/makeWm.nix "hyprland" "wayland" ) - { - programs.hyprland.enable = true; - programs.hyprland.withUWSM = true; - programs.uwsm = { - enable = true; - waylandCompositors ={ - hyprland = { - prettyName = "Hyprland"; - comment = "Hyprland compositor managed by UWSM"; - binPath = "/run/current-system/sw/bin/Hyprland"; + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + (import ../../../utils/makeWm.nix "hyprland" "wayland") + { + programs.hyprland.enable = true; + programs.hyprland.withUWSM = true; + programs.uwsm = { + enable = true; + waylandCompositors = { + hyprland = { + prettyName = "Hyprland"; + comment = "Hyprland compositor managed by UWSM"; + binPath = "/run/current-system/sw/bin/Hyprland"; + }; }; }; - }; - environment.systemPackages = with pkgs; [ - hyprland - hyprshot - hypridle - hyprpaper - hyprpicker - hyprnotify - hyprcursor - hyprpolkitagent - wofi - waybar - waybar-mpris - mako - xdg-desktop-portal-gnome - xdg-desktop-portal-hyprland - wl-clipboard - ]; - } - ]); -} + environment.systemPackages = with pkgs; [ + hyprland + hyprshot + hypridle + hyprpaper + hyprpicker + hyprnotify + hyprcursor + hyprpolkitagent + wofi + waybar + waybar-mpris + mako + xdg-desktop-portal-gnome + xdg-desktop-portal-hyprland + wl-clipboard + ]; + } + ] + ); +} diff --git a/modules/desktop/wms/xfce.nix b/modules/desktop/wms/xfce.nix index 0c62ee0..8d29e8a 100644 --- a/modules/desktop/wms/xfce.nix +++ b/modules/desktop/wms/xfce.nix @@ -1,37 +1,46 @@ -{pkgs, config, lib, ...}: -let - cfg = config.addons.desktop.xfce; -in { - +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.addons.desktop.xfce; +in +{ + options.addons.desktop.xfce = { enable = lib.mkEnableOption "Enable xfce"; }; - - config = lib.mkIf cfg.enable (lib.mkMerge [ - (import ../../../utils/makeWm.nix "xfce" "x11" ) - { - environment.systemPackages = with pkgs; [ - # XFCE stuff - xfce.catfish - xfce.xfce4-appfinder - xfce.xfce4-clipman-plugin - xfce.xfce4-cpugraph-plugin - xfce.xfce4-dict - xfce.xfce4-fsguard-plugin - xfce.xfce4-genmon-plugin - xfce.xfce4-netload-plugin - xfce.xfce4-panel - xfce.xfce4-pulseaudio-plugin - xfce.xfce4-systemload-plugin - xfce.xfce4-weather-plugin - xfce.xfce4-whiskermenu-plugin - xfce.xfce4-xkb-plugin - xfce.xfdashboard - - # GNOME stuff - file-roller - gnome-disk-utility - ]; - services.xserver.desktopManager.xfce.enable = true; - }]); + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + (import ../../../utils/makeWm.nix "xfce" "x11") + { + environment.systemPackages = with pkgs; [ + # XFCE stuff + xfce.catfish + xfce.xfce4-appfinder + xfce.xfce4-clipman-plugin + xfce.xfce4-cpugraph-plugin + xfce.xfce4-dict + xfce.xfce4-fsguard-plugin + xfce.xfce4-genmon-plugin + xfce.xfce4-netload-plugin + xfce.xfce4-panel + xfce.xfce4-pulseaudio-plugin + xfce.xfce4-systemload-plugin + xfce.xfce4-weather-plugin + xfce.xfce4-whiskermenu-plugin + xfce.xfce4-xkb-plugin + xfce.xfdashboard + + # GNOME stuff + file-roller + gnome-disk-utility + ]; + services.xserver.desktopManager.xfce.enable = true; + } + ] + ); } diff --git a/modules/desktop/x11.nix b/modules/desktop/x11.nix index cdbf3a3..d0f5480 100644 --- a/modules/desktop/x11.nix +++ b/modules/desktop/x11.nix @@ -1,11 +1,17 @@ -{pkgs, lib, config, ...}: { +{ + pkgs, + lib, + config, + ... +}: +{ options.addons.desktop.x11.enable = lib.mkEnableOption "Enabled if X11 is needed for this machine"; config = lib.mkIf config.addons.desktop.x11.enable { services.xserver = { - enable = true; - excludePackages = with pkgs; [ - xterm - ]; - }; - }; + enable = true; + excludePackages = with pkgs; [ + xterm + ]; + }; + }; } |
