nix-files/hosts/modules/roles/client/bluetooth-pairings.nix

26 lines
703 B
Nix

{ config, lib, pkgs, ... }:
let
install-bluetooth = pkgs.static-nix-shell.mkBash {
pname = "install-bluetooth";
src = ./.;
pkgs = [ "gnused" ];
};
in
{
config = lib.mkIf config.sane.roles.client {
# persist external pairings by default
sane.persist.sys.plaintext = [ "/var/lib/bluetooth" ];
sane.fs."/var/lib/bluetooth".generated.acl.mode = "0700";
sane.fs."/var/lib/bluetooth/.secrets.stamp" = {
wantedBeforeBy = [ "bluetooth.service" ];
generated.script.script = ''
${install-bluetooth}/bin/install-bluetooth $@
touch "/var/lib/bluetooth/.secrets.stamp"
'';
generated.script.scriptArgs = [ "/run/secrets/bt" ];
};
};
}