aboutsummaryrefslogtreecommitdiff
path: root/modules/system/nixos/bluetooth.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system/nixos/bluetooth.nix')
-rw-r--r--modules/system/nixos/bluetooth.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/system/nixos/bluetooth.nix b/modules/system/nixos/bluetooth.nix
new file mode 100644
index 0000000..1795547
--- /dev/null
+++ b/modules/system/nixos/bluetooth.nix
@@ -0,0 +1,40 @@
+{
+ lib,
+ config,
+ ...
+}: let
+ cfg = config.collinux.system.bluetooth;
+in
+ lib.mkIf cfg.enable {
+ hardware.bluetooth = {
+ enable = true;
+ powerOnBoot = true;
+
+ settings.General = {
+ ControllerMode = "bredr";
+ FastConnectable = true;
+ JustWorksRepairing = "always";
+ };
+ };
+
+ systemd.user.services."mpris-proxy" = {
+ unitConfig = {
+ BindsTo = ["bluetooth.target"];
+ After = ["bluetooth.target"];
+ };
+
+ wantedBy = ["bluetooth.target"];
+
+ # serviceConfig already exists (?)
+ };
+
+ # hardening (down to 2.1 OK)
+ systemd.services."bluetooth".serviceConfig = {
+ IPAddressDeny = "any";
+ ProtectKernelLogs = true;
+ ProtectKernelModules = lib.mkForce true;
+ RestrictAddressFamilies = ["AF_UNIX" "AF_BLUETOOTH"];
+ ProtectClock = true;
+ ProcSubset = "pid";
+ };
+ }