mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
nixos/workflows: restructure enable option
The type is probably not apprioriate since I want to be able to install multiple of them at a given time but we'll see.
This commit is contained in:
parent
3bc011a3ed
commit
580e0ebe93
@ -1,12 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.workflows.workflows.a-happy-gnome;
|
||||
workflowName = "a-happy-gnome";
|
||||
cfg = config.workflows.workflows.${workflowName};
|
||||
in
|
||||
{
|
||||
options.workflows.workflows.a-happy-gnome = {
|
||||
enable = lib.mkEnableOption "'A happy GNOME', foo-dogsquared's configuration of GNOME desktop environment";
|
||||
options.workflows.enable = lib.mkOption {
|
||||
type = with lib.types; listOf (enum [ workflowName ]);
|
||||
};
|
||||
|
||||
options.workflows.workflows.${workflowName} = {
|
||||
shellExtensions = lib.mkOption {
|
||||
type = with lib.types; listOf package;
|
||||
description = ''
|
||||
@ -81,7 +84,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = lib.mkIf (lib.elem workflowName config.workflows.enable) {
|
||||
# Enable GNOME and GDM.
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
@ -1,17 +1,14 @@
|
||||
# Themes are your graphical sessions.
|
||||
# It also contains your aesthetics even specific workflow and whatnots.
|
||||
# You can also show your desktop being modularized like this.
|
||||
{ config, lib, pkgs, foodogsquaredLib, ... }:
|
||||
# Themes are your graphical sessions. It also contains your aesthetics even
|
||||
# specific workflow and whatnots. You can also show your desktop being
|
||||
# modularized like this.
|
||||
{ lib, ... }:
|
||||
|
||||
let cfg = config.workflows;
|
||||
in {
|
||||
options.workflows.disableLimit = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
{
|
||||
options.workflows.enable = lib.mkOption {
|
||||
type = with lib.types; listOf (enum [ ]);
|
||||
default = [ ];
|
||||
description = ''
|
||||
Whether to unlock the limit for workflows. Since workflows may overlap
|
||||
with packages and configurations, this should be enabled at your own
|
||||
risk.
|
||||
A list of workflows to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
@ -19,15 +16,4 @@ in {
|
||||
./a-happy-gnome
|
||||
./knome
|
||||
];
|
||||
|
||||
config = {
|
||||
assertions = [{
|
||||
assertion =
|
||||
let
|
||||
enabledThemes = foodogsquaredLib.countAttrs (_: theme: theme.enable) cfg.workflows;
|
||||
in
|
||||
cfg.disableLimit || (enabledThemes <= 1);
|
||||
message = "Can't have more than one theme enabled at any given time.";
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.workflows.workflows.knome;
|
||||
workflowName = "knome";
|
||||
cfg = config.workflows.workflows.${workflowName};
|
||||
in
|
||||
{
|
||||
options.workflows.workflows.knome.enable = lib.mkEnableOption "KNOME, an attempt to bring as much GNOME to KDE Plasma";
|
||||
options.workflows.enable = lib.mkOption {
|
||||
type = with lib.types; listOf (enum [ workflowName ]);
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = lib.mkIf (lib.elem workflowName config.workflows.enable) {
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
desktopManager.plasma5 = {
|
||||
|
Loading…
Reference in New Issue
Block a user