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

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

View file

@ -1,6 +1,6 @@
{ 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 = {
enable = true;
desktopManager.gnome.enable = true;

View file

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