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
This commit is contained in:
anders130 2025-08-13 15:09:44 +02:00 committed by GitHub
parent 7c0f5533e1
commit 38b2ef0061
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 8 deletions

View file

@ -31,6 +31,7 @@
pipewire, pipewire,
caelestia-cli, caelestia-cli,
withCli ? false, withCli ? false,
extraRuntimeDeps ? [],
}: let }: let
runtimeDeps = runtimeDeps =
[ [
@ -53,6 +54,7 @@
findutils findutils
file file
] ]
++ extraRuntimeDeps
++ lib.optional withCli caelestia-cli; ++ lib.optional withCli caelestia-cli;
fontconfig = makeFontsConf { fontconfig = makeFontsConf {

View file

@ -34,6 +34,16 @@ in {
default = cli-default; default = cli-default;
description = "The package of Caelestia CLI"; # Doesn't override the shell's CLI, only change from home.packages 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 xdg.configFile = let
extraConfig = mkConfig = c:
if cfg.extraConfig != "" lib.pipe (
then cfg.extraConfig if c.extraConfig != ""
else "{}"; then c.extraConfig
in else "{}"
builtins.toJSON (lib.recursiveUpdate ) [
(cfg.settings or {}) (builtins.fromJSON extraConfig)); 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; home.packages = [shell] ++ lib.optional cfg.cli.enable cli;
}; };