networkd-dispatcher: Add patch support store files

+19
+6
pkgs/tools/networking/networkd-dispatcher/default.nix
··· 19 19 hash = "sha256-yO9/HlUkaQmW/n9N3vboHw//YMzBjxIHA2zAxgZNEv0="; 20 20 }; 21 21 22 + patches = [ 23 + # Support rule files in NixOS store paths. Required for the networkd-dispatcher 24 + # module to work 25 + ./support_nix_store_path.patch 26 + ]; 27 + 22 28 postPatch = '' 23 29 # Fix paths in systemd unit file 24 30 substituteInPlace networkd-dispatcher.service \
+13
pkgs/tools/networking/networkd-dispatcher/support_nix_store_path.patch
··· 1 + diff --git a/networkd-dispatcher b/networkd-dispatcher 2 + index ef877ce..8c341f2 100755 3 + --- a/networkd-dispatcher 4 + +++ b/networkd-dispatcher 5 + @@ -171,6 +171,8 @@ def check_perms(path, mode=0o755, uid=0, gid=0): 6 + 7 + if not os.path.exists(path): 8 + raise FileNotFoundError 9 + + if re.search('^/nix/store/.*', str(path)): 10 + + return True 11 + st = os.stat(path, follow_symlinks=False) 12 + st_mode = st.st_mode & 0x00FFF 13 + if st.st_uid == uid and st.st_gid == gid and st_mode == mode: