From 1e4312b3ce0473e6350cb686ab0f4ab7499b583d Mon Sep 17 00:00:00 2001 From: Johan Date: Sun, 28 Apr 2024 12:25:35 +0200 Subject: [PATCH] nix: Add macOS launchd service to hm-module module (#110) Home manager has the possibility to run macOS launchd services. These are automatically disabled when running on linux. --- nix/hm-module.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 50bf13e..9484a37 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -24,7 +24,12 @@ in { systemd = mkOption { type = types.bool; default = pkgs.stdenv.isLinux; - description = "Whether to enable to systemd service for lan-mouse."; + description = "Whether to enable to systemd service for lan-mouse on linux."; + }; + launchd = mkOption { + type = types.bool; + default = pkgs.stdenv.isDarwin; + description = "Whether to enable to launchd service for lan-mouse on macOS."; }; settings = lib.mkOption { inherit (tomlFormat) type; @@ -55,6 +60,17 @@ in { ]; }; + launchd.agents.lan-mouse = lib.mkIf cfg.launchd { + enable = true; + config = { + ProgramArguments = [ + "${cfg.package}/bin/lan-mouse" + "--daemon" + ]; + KeepAlive = true; + }; + }; + home.packages = [ cfg.package ];