44 lines
955 B
Nix
44 lines
955 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
pkgs-unstable,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.elephant;
|
|
wrappedPackage = pkgs.symlinkJoin {
|
|
inherit (cfg.package) name meta;
|
|
paths = [ cfg.package ];
|
|
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
|
|
postBuild = ''
|
|
wrapProgram $out/bin/elephant \
|
|
--prefix PATH : ${lib.makeBinPath [ pkgs.bash ]}
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
options.services.elephant = {
|
|
enable = lib.mkEnableOption "Enable Elephant";
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs-unstable.elephant;
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.user.services.elephant = {
|
|
Unit = {
|
|
Description = "Elephant";
|
|
After = [ "niri.service" ];
|
|
Wants = [ "niri.service" ];
|
|
};
|
|
Service = {
|
|
ExecStart = lib.getExe wrappedPackage;
|
|
Restart = "on-failure";
|
|
};
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
}
|