1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00
This commit is contained in:
Austin Horstman 2025-03-28 17:10:14 -05:00 committed by GitHub
commit 8e515bd98c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,46 +1,71 @@
{ config, lib, pkgs, ... }:
with lib;
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.skhd;
in
inherit (lib) mkOption types;
in
{
options = {
services.skhd.enable = mkOption {
options.services.skhd = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the skhd hotkey daemon.";
};
services.skhd.package = mkOption {
package = mkOption {
type = types.package;
default = pkgs.skhd;
description = "This option specifies the skhd package to use.";
};
services.skhd.skhdConfig = mkOption {
skhdConfig = mkOption {
type = types.lines;
default = "";
example = "alt + shift - r : chunkc quit";
description = "Config to use for {file}`skhdrc`.";
};
errorLogFile = mkOption {
type = types.path;
default = "/tmp/skhd.err.log";
example = "/Users/khaneliman/Library/Logs/skhd.log";
description = "Path to the error log file.";
};
outLogFile = mkOption {
type = types.path;
default = "/tmp/skhd.out.log";
example = "/Users/khaneliman/Library/Logs/skhd.log";
description = "Path to the stdout log file.";
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.etc."skhdrc".text = cfg.skhdConfig;
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [ cfg.package ];
etc."skhdrc".text = cfg.skhdConfig;
};
launchd.user.agents.skhd = {
path = [ config.environment.systemPath ];
serviceConfig.ProgramArguments = [ "${cfg.package}/bin/skhd" ]
++ optionals (cfg.skhdConfig != "") [ "-c" "/etc/skhdrc" ];
serviceConfig.KeepAlive = true;
serviceConfig.ProcessType = "Interactive";
serviceConfig = {
ProgramArguments =
[ "${cfg.package}/bin/skhd" ]
++ lib.optionals (cfg.skhdConfig != "") [
"-c"
"/etc/skhdrc"
];
KeepAlive = true;
ProcessType = "Interactive";
StandardErrorPath = cfg.errorLogFile;
StandardOutPath = cfg.outLogFile;
};
};
};
}