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

27 lines
583 B
Nix

{pkgs, ...}: let
addNuShebang = path:
builtins.concatStringsSep "\n\n" [
"#!${pkgs.nushell}/bin/nu"
(builtins.readFile path)
];
in {
networking.networkmanager.dispatcherScripts = [
{
type = "basic";
source = pkgs.writeText "dispatcher" (addNuShebang ./dispatcher.nu);
}
];
environment.etc = with builtins; (
listToAttrs (
map (v: {
name = "networkhooks/${v}";
value = {
text = addNuShebang ./hooks/${v};
mode = "0755";
};
})
(attrNames (readDir ./hooks))
)
);
}