lol

nixos/networkd-dispatcher: use writeShellApplication to ease use

Patrick 7a564cf0 26e4636d

+23 -15
+23 -15
nixos/modules/services/networking/networkd-dispatcher.nix
··· 103 103 104 104 services.networkd-dispatcher.extraArgs = 105 105 let 106 - scriptDir = pkgs.symlinkJoin { 107 - name = "networkd-dispatcher-script-dir"; 108 - paths = lib.mapAttrsToList ( 109 - name: cfg: 110 - (map ( 111 - state: 112 - pkgs.writeTextFile { 113 - inherit name; 114 - text = cfg.script; 115 - destination = "/${state}.d/${name}"; 116 - executable = true; 117 - } 118 - ) cfg.onState) 119 - ) cfg.rules; 120 - }; 106 + scriptDir = pkgs.runCommand "networkd-dispatcher-script-dir" { } ( 107 + '' 108 + mkdir $out 109 + '' 110 + + (lib.concatStrings ( 111 + lib.mapAttrsToList ( 112 + name: cfg: 113 + (lib.concatStrings ( 114 + map (state: '' 115 + mkdir -p $out/${state}.d 116 + ln -s ${ 117 + lib.getExe ( 118 + pkgs.writeShellApplication { 119 + inherit name; 120 + text = cfg.script; 121 + } 122 + ) 123 + } $out/${state}.d/${name} 124 + '') cfg.onState 125 + )) 126 + ) cfg.rules 127 + )) 128 + ); 121 129 in 122 130 [ 123 131 "--verbose"