diff options
| author | flpflan <flpflan@gmail.com> | 2025-10-31 23:48:17 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-01 02:48:17 +1100 |
| commit | ea20e02d61c9d3bede58d4edf42eb711e538ffe8 (patch) | |
| tree | 2ae3f6133944a662b0bf9034a22cb959518a94bd /nix/hm-module.nix | |
| parent | background: fix wallpaper loading on init (diff) | |
| download | caelestia-shell-ea20e02d61c9d3bede58d4edf42eb711e538ffe8.tar.gz caelestia-shell-ea20e02d61c9d3bede58d4edf42eb711e538ffe8.tar.bz2 caelestia-shell-ea20e02d61c9d3bede58d4edf42eb711e538ffe8.zip | |
nix/hm: prevent generation of configuration file when config is empty (#867)
Diffstat (limited to 'nix/hm-module.nix')
| -rw-r--r-- | nix/hm-module.nix | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 92f2f51..2976cf6 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -68,7 +68,7 @@ in { }; extraConfig = mkOption { type = types.str; - default = "{}"; + default = ""; description = "Caelestia CLI extra configs written to cli.json"; }; }; @@ -121,9 +121,14 @@ in { (lib.recursiveUpdate c.settings) builtins.toJSON ]; + shouldGenerate = c: c.extraConfig != "" || c.settings != {}; in { - "caelestia/shell.json".text = mkConfig cfg; - "caelestia/cli.json".text = mkConfig cfg.cli; + "caelestia/shell.json" = lib.mkIf (shouldGenerate cfg) { + text = mkConfig cfg; + }; + "caelestia/cli.json" = lib.mkIf (shouldGenerate cfg.cli) { + text = mkConfig cfg.cli; + }; }; home.packages = [shell] ++ lib.optional cfg.cli.enable cli; |