39 lines
933 B
Nix
39 lines
933 B
Nix
{ lib, pkgs, config, ... }:
|
|
let
|
|
configurer = pkgs.substituteAll {
|
|
src = ./configurer.py;
|
|
isExecutable = true;
|
|
|
|
python = pkgs.python3.withPackages (ps: with ps; [ pyyaml ]);
|
|
utilLinux = pkgs.util-linux;
|
|
wireguardTools = pkgs.wireguard-tools;
|
|
systemd = config.systemd.package;
|
|
iwd = config.networking.wireless.iwd.package;
|
|
};
|
|
in
|
|
{
|
|
config = {
|
|
systemd = {
|
|
services = {
|
|
qclk-configurer = {
|
|
description = "qclk dynamic configurer";
|
|
after = [ "network.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "notify-reload";
|
|
ExecStart = "${configurer} serve";
|
|
};
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
};
|
|
};
|
|
|
|
services = {
|
|
udev.extraRules = ''
|
|
SUBSYSTEM=="block", ACTION=="add", ENV{ID_BUS}=="usb", ENV{ID_FS_TYPE}=="vfat", RUN+="${configurer} ext-load %E{ID_PATH_TAG} %N"
|
|
'';
|
|
};
|
|
};
|
|
}
|