install-bluetooth: port to nix-shell

This commit is contained in:
Colin 2023-07-02 22:42:52 +00:00
parent 67bf15cca2
commit 6b55faec0c
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,12 @@
{ config, lib, pkgs, ... }:
let
install-bluetooth = pkgs.static-nix-shell.mkBash {
pname = "install-bluetooth";
src = ../../../../scripts;
pkgs = [ "gnused" ];
};
in
{
config = lib.mkIf config.sane.roles.client {
# persist external pairings by default
@ -8,8 +15,8 @@
sane.fs."/var/lib/bluetooth".generated.acl.mode = "0700";
sane.fs."/var/lib/bluetooth/.secrets.stamp" = {
wantedBeforeBy = [ "bluetooth.service" ];
# XXX: install-bluetooth uses sed, but that's part of the default systemd unit path, it seems
generated.script.script = builtins.readFile ../../../../scripts/install-bluetooth + ''
generated.script.script = ''
${install-bluetooth}/bin/install-bluetooth $@
touch "/var/lib/bluetooth/.secrets.stamp"
'';
generated.script.scriptArgs = [ "/run/secrets/bt" ];

View File

@ -12,7 +12,6 @@ in
sane.fs."/var/lib/iwd/.secrets.psk.stamp" = {
wantedBeforeBy = [ "iwd.service" ];
generated.acl.mode = "0600";
# XXX: install-iwd uses sed, but that's part of the default systemd unit path, it seems
generated.script.script = ''
${install-iwd}/bin/install-iwd $@
touch "/var/lib/iwd/.secrets.psk.stamp"

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p gnused
# usage: install-bluetooth <source_dir> <destdir>
# source_dir contains plain-text files of any filename.
# for each file, this extracts the MAC and creates a symlink in destdir which