Files
home-manager/modules/services/elephant.nix
Austin Horstman 84ddd33ed0 elephant: add module
Add a service module for Elephant with package installation, provider selection, TOML config generation, and a systemd user service.

This gives Elephant its own configuration surface instead of wiring it through Walker.
2026-05-17 22:25:27 -05:00

65 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.elephant;
tomlFormat = pkgs.formats.toml { };
in
{
meta.maintainers = [ ];
options.services.elephant = {
enable = lib.mkEnableOption "elephant";
package = lib.mkPackageOption pkgs "elephant" {
example = ''
pkgs.elephant.override {
enabledProviders = [
"desktopapplications"
"runner"
];
}
'';
};
settings = lib.mkOption {
inherit (tomlFormat) type;
default = { };
example = {
providers.default = [
"desktopapplications"
"runner"
];
};
description = ''
Configuration settings for Elephant.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.elephant" pkgs lib.platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."elephant/config.toml" = lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "elephant-config" cfg.settings;
};
systemd.user.services.elephant = {
Unit.Description = "Elephant - Data provider for application launchers";
Install.WantedBy = [ "graphical-session.target" ];
Service = {
ExecStart = lib.getExe cfg.package;
Restart = "on-failure";
};
};
};
}