{ lib, mkTextDerivation }: with lib; { config, name, ... }: let sourceDrv = mkTextDerivation name config.text; in { options = { enable = mkOption { type = types.bool; default = true; description = '' Whether this /etc file should be generated. This option allows specific /etc files to be disabled. ''; }; text = mkOption { default = null; type = types.nullOr types.lines; description = '' Text of the file. ''; }; target = mkOption { type = types.str; default = name; description = '' Name of symlink (relative to /etc). Defaults to the attribute name. ''; }; source = mkOption { type = types.path; description = '' Path of the source file. ''; }; }; config = { source = mkIf (config.text != null) (mkDefault sourceDrv); }; }