Add default settings file support for Dank Material Shell (DMS)
- Introduced a new option `defaultSettingsFile` in the DMS configuration to allow host-specific first-run settings. - Updated the home-manager module to read from the specified settings file if provided, otherwise falling back to the bundled defaults. - Enhanced the documentation in the default settings file to clarify its purpose and usage.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# Defaults written once to ~/.config/DankMaterialShell/settings.json on first login.
|
||||
# After that, DMS settings are owned by the UI — rebuilds do not overwrite them.
|
||||
# Generic defaults written once to ~/.config/DankMaterialShell/settings.json on first login.
|
||||
# Hosts can override via `chiasson.desktop.shells.dms.defaultSettingsFile` (see 14900k).
|
||||
# After seeding, DMS settings are owned by the UI — rebuilds do not overwrite them.
|
||||
{
|
||||
lib,
|
||||
gpuTempEnabled ? true,
|
||||
|
||||
@@ -38,6 +38,15 @@
|
||||
example = [ "sudo" "nixos-rebuild" "switch" "--flake" ".#14900k" ];
|
||||
description = "Command used by DMS nix-monitor widget for rebuild actions.";
|
||||
};
|
||||
defaultSettingsFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
example = ./dms-default-settings.json;
|
||||
description = ''
|
||||
Host-specific first-run `settings.json` seed. When set, replaces the bundled
|
||||
`default-settings.nix` template on fresh profiles.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -85,6 +94,7 @@
|
||||
])
|
||||
++ (cfg.extraRightBarWidgets or [ ]);
|
||||
programs.nix-monitor.rebuildCommand = rebuildCommand;
|
||||
dms.defaultSettingsFile = cfg.defaultSettingsFile or null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -59,10 +59,14 @@
|
||||
'';
|
||||
|
||||
jsonFormat = pkgs.formats.json { };
|
||||
dmsSeedSettings = import ../_private/default-settings.nix {
|
||||
inherit lib gpuTempEnabled;
|
||||
extraRightBarWidgets = cfg.extraRightBarWidgets;
|
||||
};
|
||||
dmsSeedSettings =
|
||||
if cfg.defaultSettingsFile != null then
|
||||
builtins.fromJSON (builtins.readFile cfg.defaultSettingsFile)
|
||||
else
|
||||
import ../_private/default-settings.nix {
|
||||
inherit lib gpuTempEnabled;
|
||||
extraRightBarWidgets = cfg.extraRightBarWidgets;
|
||||
};
|
||||
dmsSeedFile = jsonFormat.generate "dms-settings-seed.json" dmsSeedSettings;
|
||||
dmsSettingsPath = "${config.xdg.configHome}/DankMaterialShell/settings.json";
|
||||
|
||||
@@ -126,6 +130,15 @@ in {
|
||||
dms.enableRbwLockToggle = lib.mkEnableOption ''
|
||||
Ship rbw-lock-toggle into `~/.config/DankMaterialShell/plugins/rbwLockToggle/` (directory name matches plugin id; Bitwarden vault lock/unlock in the bar).
|
||||
'';
|
||||
|
||||
dms.defaultSettingsFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Host-specific first-run `settings.json` seed. When set, replaces the bundled
|
||||
`default-settings.nix` template on fresh profiles.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
|
||||
Reference in New Issue
Block a user