diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-08-17 11:25:33 +0200 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-08-17 11:25:33 +0200 |
| commit | 1be972048dd58218cd689ecb5cac562eb398b751 (patch) | |
| tree | 203f19ee01ad5fe28f2868e8c1451f9538e4ab12 /modules/desktop | |
| parent | 3cd59d4670711e34a50adea912c3b0894883e490 (diff) | |
refreshed config
Diffstat (limited to 'modules/desktop')
| -rw-r--r-- | modules/desktop/common.nix | 72 | ||||
| -rw-r--r-- | modules/desktop/default.nix | 49 | ||||
| -rw-r--r-- | modules/desktop/wayland.nix | 6 | ||||
| -rw-r--r-- | modules/desktop/wms/default.nix | 6 | ||||
| -rw-r--r-- | modules/desktop/wms/hyprland.nix | 43 | ||||
| -rw-r--r-- | modules/desktop/wms/xfce.nix | 37 | ||||
| -rw-r--r-- | modules/desktop/x11.nix | 11 |
7 files changed, 224 insertions, 0 deletions
diff --git a/modules/desktop/common.nix b/modules/desktop/common.nix new file mode 100644 index 0000000..088ad73 --- /dev/null +++ b/modules/desktop/common.nix @@ -0,0 +1,72 @@ +{pkgs, config, lib, ...}: { + options.addons.desktop.enable = lib.mkEnableOption "On if the machine needs a desktop"; + + 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 + ]; + }; + }; + + environment.systemPackages = with pkgs; [ + xdg-user-dirs + zathura + sioyek + vlc + mpv + gparted + kitty + # qalculate + networkmanagerapplet + 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; + }; + + displayManager.sddm = { + enable=true; + #theme = "catppuccin-mocha"; + }; + + }; + + i18n.inputMethod = { + type = "fcitx5"; + enable = true; + fcitx5.addons = with pkgs; [ + fcitx5-gtk + fcitx5-lua + fcitx5-mozc + catppuccin-fcitx5 + fcitx5-table-other + ]; + }; + + fonts.packages = with pkgs; [ + noto-fonts + font-awesome + nerd-fonts.hurmit + minecraftia + ]; + }; +} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix new file mode 100644 index 0000000..c3e0b45 --- /dev/null +++ b/modules/desktop/default.nix @@ -0,0 +1,49 @@ +{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 + enabledWMs = (filter (wm: wm.enable) (attrValues wmMeta)); + protos = (unique (map (wm: wm.protocol) enabledWMs)); + desktopEnabled = protos != []; + x11Enabled = elem "x11" protos; + waylandEnabled = elem "wayland" protos; + + +in { + imports = [ + ./common.nix + ./x11.nix + ./wayland.nix + ./wms + ]; + 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)"; + }; + }; + }); + 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."; + }; + + config.addons.desktop = { + enable = desktopEnabled; + x11.enable = x11Enabled; + wayland.enable = waylandEnabled; + }; +} diff --git a/modules/desktop/wayland.nix b/modules/desktop/wayland.nix new file mode 100644 index 0000000..0b78daf --- /dev/null +++ b/modules/desktop/wayland.nix @@ -0,0 +1,6 @@ +{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; + }; +} diff --git a/modules/desktop/wms/default.nix b/modules/desktop/wms/default.nix new file mode 100644 index 0000000..94d0e05 --- /dev/null +++ b/modules/desktop/wms/default.nix @@ -0,0 +1,6 @@ +{...}: { + imports = [ + ./hyprland.nix + ./xfce.nix + ]; +} diff --git a/modules/desktop/wms/hyprland.nix b/modules/desktop/wms/hyprland.nix new file mode 100644 index 0000000..8243b3d --- /dev/null +++ b/modules/desktop/wms/hyprland.nix @@ -0,0 +1,43 @@ +{pkgs, lib, config, ...}: + let cfg = config.addons.desktop.hyprland; +in { + options.addons.desktop.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"; + }; + }; + }; + + 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 new file mode 100644 index 0000000..0c62ee0 --- /dev/null +++ b/modules/desktop/wms/xfce.nix @@ -0,0 +1,37 @@ +{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; + }]); +} diff --git a/modules/desktop/x11.nix b/modules/desktop/x11.nix new file mode 100644 index 0000000..cdbf3a3 --- /dev/null +++ b/modules/desktop/x11.nix @@ -0,0 +1,11 @@ +{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 + ]; + }; + }; +} |
