nix-configs/modules/net/dispatchers/default.nix

30 lines
583 B
Nix
Raw Normal View History

2025-04-11 09:20:46 +02:00
{ pkgs, ... }:
let
addNuShebang =
path:
2025-03-27 20:18:54 +01:00
builtins.concatStringsSep "\n\n" [
"#!${pkgs.nushell}/bin/nu"
(builtins.readFile path)
];
2025-04-11 09:20:46 +02:00
in
{
2025-03-27 20:18:54 +01:00
networking.networkmanager.dispatcherScripts = [
{
type = "basic";
source = pkgs.writeText "dispatcher" (addNuShebang ./dispatcher.nu);
}
];
2025-04-11 09:20:46 +02:00
environment.etc =
with builtins;
(listToAttrs (
2025-03-27 20:18:54 +01:00
map (v: {
name = "networkhooks/${v}";
value = {
text = addNuShebang ./hooks/${v};
mode = "0755";
};
2025-04-11 09:20:46 +02:00
}) (attrNames (readDir ./hooks))
));
2025-03-27 20:18:54 +01:00
}