mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
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.
65 lines
1.3 KiB
Nix
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";
|
|
};
|
|
};
|
|
};
|
|
}
|