Add DMS configuration and helper scripts
- Introduced a new `justfile` for managing DMS-related tasks, including a recipe for syncing live DMS configuration. - Added a `devshell.nix` file to set up a development environment with necessary packages and shell hooks for DMS. - Updated DMS settings to replace `defaultSettingsFile` with `defaultSeedDir` for improved configuration management. - Created a new script `sync-seed.sh` to facilitate syncing DMS settings from the live configuration to host-specific directories. - Enhanced documentation and examples for DMS configuration and usage.
This commit is contained in:
@@ -59,16 +59,26 @@
|
||||
'';
|
||||
|
||||
jsonFormat = pkgs.formats.json { };
|
||||
dmsSeedSettings =
|
||||
if cfg.defaultSettingsFile != null then
|
||||
builtins.fromJSON (builtins.readFile cfg.defaultSettingsFile)
|
||||
dmsConfigDir = "${config.xdg.configHome}/DankMaterialShell";
|
||||
defaultSeedDir = lib.attrByPath [ "chiasson" "desktop" "shells" "dms" "defaultSeedDir" ] null osConfig;
|
||||
|
||||
dmsSeedSources =
|
||||
if defaultSeedDir != null then
|
||||
{
|
||||
"settings.json" = defaultSeedDir + "/settings.json";
|
||||
}
|
||||
// lib.optionalAttrs (builtins.pathExists (defaultSeedDir + "/plugin_settings.json")) {
|
||||
"plugin_settings.json" = defaultSeedDir + "/plugin_settings.json";
|
||||
}
|
||||
else
|
||||
import ../_private/default-settings.nix {
|
||||
inherit lib gpuTempEnabled;
|
||||
extraRightBarWidgets = cfg.extraRightBarWidgets;
|
||||
{
|
||||
"settings.json" = jsonFormat.generate "dms-settings-seed.json" (
|
||||
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";
|
||||
|
||||
# Directory name must match each plugin's `id` in plugin.json.
|
||||
thirdPartyPlugins = {
|
||||
@@ -158,15 +168,6 @@ in {
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
dms.bundleThirdPartyPlugins = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
@@ -270,22 +271,25 @@ in {
|
||||
session = { };
|
||||
};
|
||||
|
||||
# Detach store symlink so UI edits survive rebuilds; seed defaults only on a fresh profile.
|
||||
home.activation.dmsMaterializeSettings = lib.hm.dag.entryBefore [ "writeBoundary" ] ''
|
||||
settingsFile=${lib.escapeShellArg dmsSettingsPath}
|
||||
if [ -L "$settingsFile" ]; then
|
||||
mkdir -p "$(dirname "$settingsFile")"
|
||||
${pkgs.coreutils}/bin/cp --remove-destination -L "$settingsFile" "$settingsFile"
|
||||
fi
|
||||
'';
|
||||
|
||||
home.activation.dmsSeedSettings = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
settingsFile=${lib.escapeShellArg dmsSettingsPath}
|
||||
mkdir -p "$(dirname "$settingsFile")"
|
||||
if [ ! -e "$settingsFile" ]; then
|
||||
${pkgs.coreutils}/bin/cp ${lib.escapeShellArg dmsSeedFile} "$settingsFile"
|
||||
chmod u+w "$settingsFile"
|
||||
fi
|
||||
# Detach store symlinks so UI edits survive rebuilds; seed defaults only on a fresh profile.
|
||||
home.activation.dmsSeedConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
${lib.concatMapStringsSep "\n" (
|
||||
fileName:
|
||||
let
|
||||
dest = "${dmsConfigDir}/${fileName}";
|
||||
src = dmsSeedSources.${fileName};
|
||||
in ''
|
||||
dest=${lib.escapeShellArg dest}
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
if [ -L "$dest" ]; then
|
||||
${pkgs.coreutils}/bin/cp --remove-destination -L "$dest" "$dest"
|
||||
fi
|
||||
if [ ! -e "$dest" ]; then
|
||||
${pkgs.coreutils}/bin/cp ${lib.escapeShellArg src} "$dest"
|
||||
chmod u+w "$dest"
|
||||
fi
|
||||
''
|
||||
) (lib.attrNames dmsSeedSources)}
|
||||
'';
|
||||
|
||||
# matugen won't create missing output_path parents; run before DMS theme generation.
|
||||
|
||||
Reference in New Issue
Block a user