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.
This commit is contained in:
Johan
2024-04-28 12:25:35 +02:00
committed by GitHub
parent 77aa96e09a
commit 1e4312b3ce

View File

@@ -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
];