From 22fd05adeeae38dd23be4b4c0ffb18f3f1fd264c Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 3 Mar 2023 19:31:18 +0100 Subject: [PATCH] networkd-dispatcher: Add patch support store files --- .../networking/networkd-dispatcher/default.nix | 6 ++++++ .../support_nix_store_path.patch | 13 +++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 pkgs/tools/networking/networkd-dispatcher/support_nix_store_path.patch diff --git a/pkgs/tools/networking/networkd-dispatcher/default.nix b/pkgs/tools/networking/networkd-dispatcher/default.nix index b8812cb678d..161772ed481 100644 --- a/pkgs/tools/networking/networkd-dispatcher/default.nix +++ b/pkgs/tools/networking/networkd-dispatcher/default.nix @@ -19,6 +19,12 @@ stdenv.mkDerivation rec { hash = "sha256-yO9/HlUkaQmW/n9N3vboHw//YMzBjxIHA2zAxgZNEv0="; }; + patches = [ + # Support rule files in NixOS store paths. Required for the networkd-dispatcher + # module to work + ./support_nix_store_path.patch + ]; + postPatch = '' # Fix paths in systemd unit file substituteInPlace networkd-dispatcher.service \ diff --git a/pkgs/tools/networking/networkd-dispatcher/support_nix_store_path.patch b/pkgs/tools/networking/networkd-dispatcher/support_nix_store_path.patch new file mode 100644 index 00000000000..6d32548f188 --- /dev/null +++ b/pkgs/tools/networking/networkd-dispatcher/support_nix_store_path.patch @@ -0,0 +1,13 @@ +diff --git a/networkd-dispatcher b/networkd-dispatcher +index ef877ce..8c341f2 100755 +--- a/networkd-dispatcher ++++ b/networkd-dispatcher +@@ -171,6 +171,8 @@ def check_perms(path, mode=0o755, uid=0, gid=0): + + if not os.path.exists(path): + raise FileNotFoundError ++ if re.search('^/nix/store/.*', str(path)): ++ return True + st = os.stat(path, follow_symlinks=False) + st_mode = st.st_mode & 0x00FFF + if st.st_uid == uid and st.st_gid == gid and st_mode == mode: