From 1683c507c2c58a502294330de940e2b4b51bdf75 Mon Sep 17 00:00:00 2001 From: Kylie McClain Date: Sun, 4 Feb 2024 18:07:19 -0500 Subject: [PATCH] vdirsyncer: create postHook script when non-empty --- modules/programs/vdirsyncer-accounts.nix | 4 ++-- modules/programs/vdirsyncer.nix | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/programs/vdirsyncer-accounts.nix b/modules/programs/vdirsyncer-accounts.nix index 35badb927..fac4d01da 100644 --- a/modules/programs/vdirsyncer-accounts.nix +++ b/modules/programs/vdirsyncer-accounts.nix @@ -137,8 +137,8 @@ in { }; postHook = mkOption { - type = types.lines; - default = ""; + type = types.nullOr types.lines; + default = null; description = '' Command to call for each item creation and modification. The command will be called with the path of the new/updated diff --git a/modules/programs/vdirsyncer.nix b/modules/programs/vdirsyncer.nix index ec1b38796..545df71b5 100644 --- a/modules/programs/vdirsyncer.nix +++ b/modules/programs/vdirsyncer.nix @@ -26,8 +26,9 @@ let filterAttrs (_: v: v != null) ((getAttrs [ "type" "fileExt" "encoding" ] a.local) // { path = a.local.path; - postHook = pkgs.writeShellScriptBin "post-hook" a.vdirsyncer.postHook - + "/bin/post-hook"; + postHook = optionalString (a.vdirsyncer.postHook != null) + (pkgs.writeShellScriptBin "post-hook" a.vdirsyncer.postHook + + "/bin/post-hook"); }); remoteStorage = a: