diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/nixos/cooklang-chef.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/nixos/cooklang-chef.nix b/modules/nixos/cooklang-chef.nix index 65af966..823227c 100644 --- a/modules/nixos/cooklang-chef.nix +++ b/modules/nixos/cooklang-chef.nix @@ -59,6 +59,8 @@ in { default = "/"; }; }; + + restartOnChanges = mkEnableOption "Restart cooklang-chef service on changes to ${cfg.recipeRoot}"; }; config = mkIf cfg.enable { @@ -118,6 +120,25 @@ in { }; }; + systemd.services.cooklang-chef-watcher = mkIf cfg.restartOnChanges { + description = "Restart cooklang-chef on file change"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "/run/current-system/sw/bin/systemctl restart cooklang-chef.service"; + Type = "oneshot"; + }; + }; + + systemd.paths.cooklang-chef-watcher = mkIf cfg.restartOnChanges { + description = "Restart cooklang-chef on file change"; + wantedBy = [ "multi-user.target" ]; + pathConfig = { + Unit = "cooklang-chef-watcher.service"; + PathChanged = cfg.recipeRoot; + }; + }; + services.nginx = mkIf cfg.nginx.enable { enable = mkDefault true; virtualHosts.${cfg.nginx.virtualHost} = { |
