nixfiles: add meta option

contains metadata about enabled modules (there's no "official" way to
check if wayland is enabled)
This commit is contained in:
NullBite 2024-02-16 17:50:43 +01:00
parent 68cad3482e
commit 33ee7046ef
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
4 changed files with 16 additions and 2 deletions

@ -13,18 +13,24 @@ in
];
config = {};
options.nixfiles = {
standalone = lib.mkOption {
meta.standalone = lib.mkOption {
default = isStandalone;
description = "Whether or not the home-manager installation is standalone (standalone installations don't have access to osConfig).";
type = lib.types.bool;
readOnly = true;
internal = true;
};
graphical = lib.mkOption {
meta.graphical = lib.mkOption {
description = "Whether to enable graphical home-manager applications";
type = lib.types.bool;
default = (osConfig ? services && osConfig.services.xserver.enable);
example = true;
};
meta.wayland = lib.mkOption {
description = "Whether to prefer wayland packages and configuration";
type = lib.types.bool;
default = (lib.hasAttrByPath [ "nixfiles" "meta" "wayland" ] osConfig) && osConfig.nixfiles.meta.wayland;
example = true;
};
};
}

@ -14,5 +14,11 @@ in
];
config = {};
options.nixfiles = {
meta.wayland = lib.mkOption {
description = "Whether to prefer wayland applications and configuration";
default = false;
example = true;
type = lib.types.bool;
};
};
}

@ -19,6 +19,7 @@ in
desktop.enable = true;
wm.enable = true;
};
nixfiles.meta.wayland = true;
services.xserver.displayManager.sddm.enable = true;

@ -21,6 +21,7 @@ in
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.displayManager.defaultSession = "plasmawayland";
programs.kdeconnect.enable = mkDefault true;
nixfiles.meta.wayland = true;
systemd.user = {
services.restart-xdg-desktop-portal-kde = {