mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
nix: update home-manager module to remove default*, add clsettings (#1233)
* nix: update home-manager module, add clsettings * nix: resolve message and rename clsettings->clipboardSettings. * nix: fix home-manager plugin_settings management. add option for whether plugin settings should be managed by nix.
This commit is contained in:
@@ -16,6 +16,12 @@ let
|
||||
dmsPkgs
|
||||
;
|
||||
};
|
||||
hasPluginSettings = lib.any (plugin: plugin.settings != { }) (
|
||||
lib.attrValues (lib.filterAttrs (n: v: v.enable) cfg.plugins)
|
||||
);
|
||||
pluginSettings = lib.mapAttrs (name: plugin: { enabled = plugin.enable; } // plugin.settings) (
|
||||
lib.filterAttrs (n: v: v.enable) cfg.plugins
|
||||
);
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -24,25 +30,48 @@ in
|
||||
"programs"
|
||||
"dank-material-shell"
|
||||
"enableNightMode"
|
||||
] "Night mode is now always available.")
|
||||
] "Night mode is now always available")
|
||||
(lib.mkRemovedOptionModule [
|
||||
"programs"
|
||||
"dank-material-shell"
|
||||
"default"
|
||||
"settings"
|
||||
] "Default settings have been removed and been replaced with programs.dank-material-shell.settings")
|
||||
(lib.mkRemovedOptionModule [
|
||||
"programs"
|
||||
"dank-material-shell"
|
||||
"default"
|
||||
"session"
|
||||
] "Default session has been removed and been replaced with programs.dank-material-shell.session")
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "programs" "dank-material-shell" "enableSystemd" ]
|
||||
[ "programs" "dank-material-shell" "systemd" "enable" ]
|
||||
)
|
||||
];
|
||||
|
||||
options.programs.dank-material-shell = with lib.types; {
|
||||
default = {
|
||||
options.programs.dank-material-shell = {
|
||||
settings = lib.mkOption {
|
||||
type = jsonFormat.type;
|
||||
default = { };
|
||||
description = "The default settings are only read if the settings.json file don't exist";
|
||||
description = "DankMaterialShell configuration settings as an attribute set, to be written to ~/.config/DankMaterialShell/settings.json.";
|
||||
};
|
||||
|
||||
clipboardSettings = lib.mkOption {
|
||||
type = jsonFormat.type;
|
||||
default = { };
|
||||
description = "DankMaterialShell clipboard settings as an attribute set, to be written to ~/.config/DankMaterialShell/clsettings.json.";
|
||||
};
|
||||
|
||||
session = lib.mkOption {
|
||||
type = jsonFormat.type;
|
||||
default = { };
|
||||
description = "The default session are only read if the session.json file don't exist";
|
||||
description = "DankMaterialShell session settings as an attribute set, to be written to ~/.local/state/DankMaterialShell/session.json.";
|
||||
};
|
||||
|
||||
managePluginSettings = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = hasPluginSettings;
|
||||
description = ''Whether to manage plugin settings. Automatically enabled if any plugins have settings configured.'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -67,22 +96,28 @@ in
|
||||
Install.WantedBy = [ config.wayland.systemd.target ];
|
||||
};
|
||||
|
||||
xdg.stateFile."DankMaterialShell/default-session.json" = lib.mkIf (cfg.default.session != { }) {
|
||||
source = jsonFormat.generate "default-session.json" cfg.default.session;
|
||||
xdg.stateFile."DankMaterialShell/session.json" = lib.mkIf (cfg.session != { }) {
|
||||
source = jsonFormat.generate "session.json" cfg.session;
|
||||
};
|
||||
|
||||
xdg.configFile = lib.mkMerge [
|
||||
(lib.mapAttrs' (name: value: {
|
||||
name = "DankMaterialShell/plugins/${name}";
|
||||
inherit value;
|
||||
}) common.plugins)
|
||||
{
|
||||
"DankMaterialShell/default-settings.json" = lib.mkIf (cfg.default.settings != { }) {
|
||||
source = jsonFormat.generate "default-settings.json" cfg.default.settings;
|
||||
xdg.configFile = {
|
||||
"DankMaterialShell/settings.json" = lib.mkIf (cfg.settings != { }) {
|
||||
source = jsonFormat.generate "settings.json" cfg.settings;
|
||||
};
|
||||
"DankMaterialShell/clsettings.json" = lib.mkIf (cfg.clipboardSettings != { }) {
|
||||
source = jsonFormat.generate "clsettings.json" cfg.clipboardSettings;
|
||||
};
|
||||
"DankMaterialShell/plugin_settings.json" = lib.mkIf cfg.managePluginSettings {
|
||||
source = jsonFormat.generate "plugin_settings.json" pluginSettings;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
// (lib.mapAttrs' (name: value: {
|
||||
name = "DankMaterialShell/plugins/${name}";
|
||||
inherit value;
|
||||
}) common.plugins);
|
||||
warnings =
|
||||
lib.optional (!cfg.managePluginSettings && hasPluginSettings)
|
||||
"You have disabled managePluginSettings but provided plugin settings. These settings will be ignored.";
|
||||
home.packages = common.packages;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ let
|
||||
"programs"
|
||||
"dank-material-shell"
|
||||
];
|
||||
|
||||
jsonFormat = pkgs.formats.json { };
|
||||
builtInRemovedMsg = "This is now built-in in DMS and doesn't need additional dependencies.";
|
||||
in
|
||||
{
|
||||
@@ -37,7 +37,7 @@ in
|
||||
};
|
||||
|
||||
dgop = {
|
||||
package = lib.mkPackageOption pkgs "dgop" {};
|
||||
package = lib.mkPackageOption pkgs "dgop" { };
|
||||
};
|
||||
|
||||
enableSystemMonitoring = lib.mkOption {
|
||||
@@ -89,6 +89,11 @@ in
|
||||
type = types.either types.package types.path;
|
||||
description = "Source of the plugin package or path";
|
||||
};
|
||||
settings = lib.mkOption {
|
||||
type = jsonFormat.type;
|
||||
default = { };
|
||||
description = "Plugin settings as an attribute set";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user