From d7d7533c18531237e458e7f29d9b072925e5bb72 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Fri, 31 Aug 2018 02:52:49 +0000 Subject: [PATCH] changes as per requested by @aszlig --- nixos/modules/services/monitoring/incron.nix | 27 +++++++++----------- pkgs/tools/system/incron/default.nix | 2 +- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/nixos/modules/services/monitoring/incron.nix b/nixos/modules/services/monitoring/incron.nix index 3857186f42d..cac93ad4712 100644 --- a/nixos/modules/services/monitoring/incron.nix +++ b/nixos/modules/services/monitoring/incron.nix @@ -20,7 +20,7 @@ in description = '' Whether to enable the incron daemon. - Note that commands run under incrontab only support common Nix profiles for the PATH provided variable. + Note that commands run under incrontab only support common Nix profiles for the PATH provided variable. ''; }; @@ -31,7 +31,7 @@ in Users allowed to use incrontab. If empty then no user will be allowed to have their own incrontab. - If null then will defer to . + If null then will defer to . If both and are null then all users will be allowed to have their own incrontab. ''; @@ -48,15 +48,15 @@ in default = ""; description = "The system incrontab contents."; example = '' - "/var/mail IN_CLOSE_WRITE abc $@/$#" - "/tmp IN_ALL_EVENTS efg $@/$# $&" + /var/mail IN_CLOSE_WRITE abc $@/$# + /tmp IN_ALL_EVENTS efg $@/$# $& ''; }; extraPackages = mkOption { type = types.listOf types.package; default = []; - example = "[ pkgs.rsync ];"; + example = literalExample "[ pkgs.rsync ]"; description = "Extra packages available to the system incrontab."; }; @@ -66,11 +66,8 @@ in config = mkIf cfg.enable { - assertions = [ - { assertion = cfg.allow != null -> cfg.deny == null; - message = "If `services.incron.allow` is set then `services.incron.deny` will be ignored."; - } - ]; + warnings = optional (cfg.allow != null && cfg.deny != null) + ''If `services.incron.allow` is set then `services.incron.deny` will be ignored.''; environment.systemPackages = [ pkgs.incron ]; @@ -79,22 +76,22 @@ in # incron won't read symlinks environment.etc."incron.d/system" = { mode = "0444"; - text = ${cfg.systab}; + text = cfg.systab; }; environment.etc."incron.allow" = mkIf (cfg.allow != null) { - text = ${concatStringsSep "\n" cfg.allow}; + text = concatStringsSep "\n" cfg.allow; }; environment.etc."incron.deny" = mkIf (cfg.deny != null) { - text = ${concatStringsSep "\n" cfg.deny}; + text = concatStringsSep "\n" cfg.deny; }; systemd.services.incron = { - description = "File system events scheduler"; + description = "File System Events Scheduler"; wantedBy = [ "multi-user.target" ]; path = cfg.extraPackages; - preStart = "mkdir -m 710 -p /var/spool/incron"; serviceConfig.Type = "forking"; serviceConfig.PIDFile = "/run/incrond.pid"; + serviceConfig.ExecStartPre = "${pkgs.coreutils}/bin/mkdir -m 710 -p /var/spool/incron"; serviceConfig.ExecStart = "${pkgs.incron}/bin/incrond"; }; }; diff --git a/pkgs/tools/system/incron/default.nix b/pkgs/tools/system/incron/default.nix index 29e3b88acc8..2afbed2f9bb 100644 --- a/pkgs/tools/system/incron/default.nix +++ b/pkgs/tools/system/incron/default.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { ''; meta = with stdenv.lib; { - description = "A daemon which monitors filesystem events and executes commands defined in system and user tables"; + description = "A cron-like daemon which handles filesystem events."; homepage = https://github.com/ar-/incron; license = licenses.gpl2; maintainers = [ maintainers.aanderse ];