mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-31 04:04:45 +00:00
Merge 14bf3ebeaf
into 75f8e4dbc5
This commit is contained in:
commit
8e515bd98c
1 changed files with 43 additions and 18 deletions
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue