system: add mutually exclusive session option
This option makes desktop-specific specialisations easier to configure
This commit is contained in:
parent
70e7558421
commit
3cf6b93eb5
@ -42,8 +42,7 @@
|
||||
specialisation.plasma.configuration = {
|
||||
system.nixos.tags = [ "Plasma" ];
|
||||
nixfiles = {
|
||||
sessions.hyprland.enable = false;
|
||||
sessions.plasma.enable = true;
|
||||
session = "plasma";
|
||||
};
|
||||
};
|
||||
|
||||
@ -65,8 +64,7 @@
|
||||
};
|
||||
programs.unbound.enable = true;
|
||||
common.remoteAccess.enable = true;
|
||||
sessions.plasma.enable = lib.mkDefault true;
|
||||
sessions.hyprland.enable = lib.mkDefault false;
|
||||
session = lib.mkDefault "hyprland";
|
||||
hardware.nvidia.modesetting.enable = true;
|
||||
packageSets.gaming.enable = true;
|
||||
};
|
||||
|
@ -36,8 +36,7 @@
|
||||
specialisation.plasma.configuration = {
|
||||
system.nixos.tags = [ "Plasma" ];
|
||||
nixfiles = {
|
||||
sessions.hyprland.enable = false;
|
||||
sessions.plasma.enable = true;
|
||||
session = "plasma";
|
||||
};
|
||||
services.displayManager.sddm.enable = lib.mkForce true;
|
||||
services.xserver.displayManager.startx.enable = lib.mkForce false;
|
||||
@ -56,8 +55,7 @@
|
||||
gaming.enable = true;
|
||||
fun.enable = true;
|
||||
};
|
||||
sessions.hyprland.enable = lib.mkDefault true;
|
||||
sessions.plasma.enable = lib.mkDefault false;
|
||||
session = lib.mkDefault "hyprland";
|
||||
programs = {
|
||||
adb.enable = true;
|
||||
unbound.enable = false;
|
||||
|
@ -1,5 +1,26 @@
|
||||
{...}:
|
||||
{ imports = [
|
||||
{ config, lib, options, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
cfg = config.nixfiles.session;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./hyprland.nix
|
||||
./plasma.nix
|
||||
];}
|
||||
];
|
||||
|
||||
options.nixfiles.session = lib.mkOption {
|
||||
description = ''
|
||||
Desktop session to enable. This option serves as a convenient way to
|
||||
enable sessions in a mutually exclusive manner, e.g., for use with
|
||||
specialisations.
|
||||
'';
|
||||
type = with types; nullOr (enum (builtins.attrNames options.nixfiles.sessions));
|
||||
default = null;
|
||||
example = "hyprland";
|
||||
};
|
||||
|
||||
config = lib.mkIf (!(builtins.isNull cfg)) {
|
||||
nixfiles.sessions.${cfg}.enable = true;
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user