mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-13 03:08:16 +01:00
the conversion procedure is simple: - find all things that look like options, ie calls to either `mkOption` or `lib.mkOption` that take an attrset. remember the attrset as the option - for all options, find a `description` attribute who's value is not a call to `mdDoc` or `lib.mdDoc` - textually convert the entire value of the attribute to MD with a few simple regexes (the set from mdize-module.sh) - if the change produced a change in the manual output, discard - if the change kept the manual unchanged, add some text to the description to make sure we've actually found an option. if the manual changes this time, keep the converted description this procedure converts 80% of nixos options to markdown. around 2000 options remain to be inspected, but most of those fail the "does not change the manual output check": currently the MD conversion process does not faithfully convert docbook tags like <code> and <package>, so any option using such tags will not be converted at all.
104 lines
2.7 KiB
Nix
104 lines
2.7 KiB
Nix
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.incron;
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
|
|
services.incron = {
|
|
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to enable the incron daemon.
|
|
|
|
Note that commands run under incrontab only support common Nix profiles for the <envar>PATH</envar> provided variable.
|
|
'';
|
|
};
|
|
|
|
allow = mkOption {
|
|
type = types.nullOr (types.listOf types.str);
|
|
default = null;
|
|
description = lib.mdDoc ''
|
|
Users allowed to use incrontab.
|
|
|
|
If empty then no user will be allowed to have their own incrontab.
|
|
If `null` then will defer to {option}`deny`.
|
|
If both {option}`allow` and {option}`deny` are null
|
|
then all users will be allowed to have their own incrontab.
|
|
'';
|
|
};
|
|
|
|
deny = mkOption {
|
|
type = types.nullOr (types.listOf types.str);
|
|
default = null;
|
|
description = lib.mdDoc "Users forbidden from using incrontab.";
|
|
};
|
|
|
|
systab = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = lib.mdDoc "The system incrontab contents.";
|
|
example = ''
|
|
/var/mail IN_CLOSE_WRITE abc $@/$#
|
|
/tmp IN_ALL_EVENTS efg $@/$# $&
|
|
'';
|
|
};
|
|
|
|
extraPackages = mkOption {
|
|
type = types.listOf types.package;
|
|
default = [];
|
|
example = literalExpression "[ pkgs.rsync ]";
|
|
description = lib.mdDoc "Extra packages available to the system incrontab.";
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
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 ];
|
|
|
|
security.wrappers.incrontab =
|
|
{ setuid = true;
|
|
owner = "root";
|
|
group = "root";
|
|
source = "${pkgs.incron}/bin/incrontab";
|
|
};
|
|
|
|
# incron won't read symlinks
|
|
environment.etc."incron.d/system" = {
|
|
mode = "0444";
|
|
text = cfg.systab;
|
|
};
|
|
environment.etc."incron.allow" = mkIf (cfg.allow != null) {
|
|
text = concatStringsSep "\n" cfg.allow;
|
|
};
|
|
environment.etc."incron.deny" = mkIf (cfg.deny != null) {
|
|
text = concatStringsSep "\n" cfg.deny;
|
|
};
|
|
|
|
systemd.services.incron = {
|
|
description = "File System Events Scheduler";
|
|
wantedBy = [ "multi-user.target" ];
|
|
path = cfg.extraPackages;
|
|
serviceConfig.PIDFile = "/run/incrond.pid";
|
|
serviceConfig.ExecStartPre = "${pkgs.coreutils}/bin/mkdir -m 710 -p /var/spool/incron";
|
|
serviceConfig.ExecStart = "${pkgs.incron}/bin/incrond --foreground";
|
|
};
|
|
};
|
|
|
|
}
|