diff options
| author | anders130 <93037023+anders130@users.noreply.github.com> | 2025-08-13 15:09:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-13 23:09:44 +1000 |
| commit | 38b2ef006192b236f479a7134998383e581df4a3 (patch) | |
| tree | 3fea05550f986415f4958ee3911a4f6d8b9aec35 | |
| parent | internal: use icon os logo instead of nerd font (diff) | |
| download | caelestia-shell-38b2ef006192b236f479a7134998383e581df4a3.tar.gz caelestia-shell-38b2ef006192b236f479a7134998383e581df4a3.tar.bz2 caelestia-shell-38b2ef006192b236f479a7134998383e581df4a3.zip | |
nix: extend `hm-module` for CLI config options and add `extraRuntimeDeps` to package (#410)
* nix: make runtimeDeps extendible
* nix: add settings for caelestia-cli
* nix: fix option description
| -rw-r--r-- | nix/default.nix | 2 | ||||
| -rw-r--r-- | nix/hm-module.nix | 33 |
2 files changed, 27 insertions, 8 deletions
diff --git a/nix/default.nix b/nix/default.nix index 8012721..4c2f7df 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -31,6 +31,7 @@ pipewire, caelestia-cli, withCli ? false, + extraRuntimeDeps ? [], }: let runtimeDeps = [ @@ -53,6 +54,7 @@ findutils file ] + ++ extraRuntimeDeps ++ lib.optional withCli caelestia-cli; fontconfig = makeFontsConf { diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 631ee4a..9876826 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -34,6 +34,16 @@ in { default = cli-default; description = "The package of Caelestia CLI"; # Doesn't override the shell's CLI, only change from home.packages }; + settings = mkOption { + type = types.attrs; + default = {}; + description = "Caelestia CLI settings"; + }; + extraConfig = mkOption { + type = types.str; + default = "{}"; + description = "Caelestia CLI extra configs written to cli.json"; + }; }; }; }; @@ -68,14 +78,21 @@ in { }; }; - xdg.configFile."caelestia/shell.json".text = let - extraConfig = - if cfg.extraConfig != "" - then cfg.extraConfig - else "{}"; - in - builtins.toJSON (lib.recursiveUpdate - (cfg.settings or {}) (builtins.fromJSON extraConfig)); + xdg.configFile = let + mkConfig = c: + lib.pipe ( + if c.extraConfig != "" + then c.extraConfig + else "{}" + ) [ + builtins.fromJSON + (lib.recursiveUpdate c.settings) + builtins.toJSON + ]; + in { + "caelestia/shell.json".text = mkConfig cfg; + "caelestia/cli.json".text = mkConfig cfg.cli; + }; home.packages = [shell] ++ lib.optional cfg.cli.enable cli; }; |