Use boolean to enable/disable sway and gnome

This commit is contained in:
Jakob Lechner 2025-07-30 23:41:40 +02:00
parent c1d55914dd
commit cad6f04d73
5 changed files with 13 additions and 10 deletions

View file

@ -47,7 +47,10 @@
bootloader = "systemd-boot"; bootloader = "systemd-boot";
bluetooth.enable = true; bluetooth.enable = true;
uefi.enable = true; uefi.enable = true;
gui.enable = true; gui = {
enable = true;
sway.enable = true;
};
workstation.enable = true; workstation.enable = true;
sdr.enable = true; sdr.enable = true;
libvirt.enable = true; libvirt.enable = true;

View file

@ -59,7 +59,10 @@
bootloader = "lanzaboote"; bootloader = "lanzaboote";
bluetooth.enable = true; bluetooth.enable = true;
uefi.enable = true; uefi.enable = true;
gui.enable = true; gui = {
enable = true;
sway.enable = true;
};
workstation.enable = true; workstation.enable = true;
sdr.enable = true; sdr.enable = true;
libvirt.enable = true; libvirt.enable = true;

View file

@ -4,11 +4,8 @@
options.jalr = { options.jalr = {
gui = { gui = {
enable = lib.mkEnableOption "GUI"; enable = lib.mkEnableOption "GUI";
desktop = lib.mkOption { sway.enable = lib.mkEnableOption "sway";
type = lib.types.nullOr (lib.types.enum [ "sway" "gnome" ]); gnome.enable = lib.mkEnableOption "gnome";
default = "sway";
description = "Desktop environment to install";
};
}; };
workstation.enable = lib.mkEnableOption "Workstation"; workstation.enable = lib.mkEnableOption "Workstation";
}; };

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
lib.mkIf (config.jalr.gui.enable && config.jalr.gui.desktop == "gnome") { lib.mkIf (config.jalr.gui.enable && config.jalr.gui.gnome.enable) {
services.xserver = { services.xserver = {
enable = true; enable = true;
desktopManager.gnome.enable = true; desktopManager.gnome.enable = true;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
lib.mkIf (config.jalr.gui.enable && config.jalr.gui.desktop == "sway") { lib.mkIf (config.jalr.gui.enable && config.jalr.gui.sway.enable) {
programs = { programs = {
wshowkeys.enable = true; wshowkeys.enable = true;
dconf.enable = true; dconf.enable = true;
@ -17,7 +17,7 @@ lib.mkIf (config.jalr.gui.enable && config.jalr.gui.desktop == "sway") {
let let
command = pkgs.writeShellScript "sway-init" '' command = pkgs.writeShellScript "sway-init" ''
systemctl --user import-environment PATH systemctl --user import-environment PATH
systemctl --user restart xdg-desktop-portal.service #systemctl --user restart xdg-desktop-portal.service
exec ${pkgs.sway}/bin/sway exec ${pkgs.sway}/bin/sway
''; '';
user = "jalr"; user = "jalr";