Add bt-agent
This commit is contained in:
parent
75d30f7bf4
commit
9b44287df7
@ -36,6 +36,11 @@
|
|||||||
|
|
||||||
environment.sessionVariables.WINEPREFIX = "/home/balsoft/.local/share/wineprefixes/default";
|
environment.sessionVariables.WINEPREFIX = "/home/balsoft/.local/share/wineprefixes/default";
|
||||||
|
|
||||||
|
services.bt-agent = {
|
||||||
|
enable = true;
|
||||||
|
capability = "NoInputNoOutput";
|
||||||
|
};
|
||||||
|
|
||||||
persist = {
|
persist = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cache.clean.enable = false; # Scary...
|
cache.clean.enable = false; # Scary...
|
||||||
|
38
modules/bt-agent.nix
Normal file
38
modules/bt-agent.nix
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{ config, pkgs, lib, ... }: {
|
||||||
|
options.services.bt-agent = with lib; {
|
||||||
|
enable = mkEnableOption "Bluetooth authentication agent";
|
||||||
|
package = mkOption {
|
||||||
|
default = pkgs.bluez-tools;
|
||||||
|
type = types.package;
|
||||||
|
};
|
||||||
|
capability = mkOption {
|
||||||
|
default = "DisplayYesNo";
|
||||||
|
description = "Agent capability";
|
||||||
|
type = types.enum [
|
||||||
|
"DisplayOnly"
|
||||||
|
"DisplayYesNo"
|
||||||
|
"KeyboardOnly"
|
||||||
|
"NoInputNoOutput"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
pinFile = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
description = "Path to the PIN's file";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = let
|
||||||
|
cfg = config.services.bt-agent;
|
||||||
|
args = [ "--capability=${cfg.capability}" ]
|
||||||
|
++ lib.optional (!isNull cfg.pinFile) "--pin=${cfg.pinFile}";
|
||||||
|
in lib.mkIf cfg.enable {
|
||||||
|
systemd.services.bt-agent = {
|
||||||
|
path = [ cfg.package ];
|
||||||
|
serviceConfig.Type = "forking";
|
||||||
|
serviceConfig.KillSignal = "SIGKILL";
|
||||||
|
script = "bt-agent -d ${lib.escapeShellArgs args}";
|
||||||
|
wantedBy = [ "bluetooth.target" ];
|
||||||
|
after = [ "bluetooth.service" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -7,6 +7,7 @@
|
|||||||
secrets
|
secrets
|
||||||
secrets-envsubst
|
secrets-envsubst
|
||||||
persist
|
persist
|
||||||
|
bt-agent
|
||||||
|
|
||||||
|
|
||||||
# PROFILES
|
# PROFILES
|
||||||
|
Loading…
Reference in New Issue
Block a user