mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/services.opensmtpd: remove with lib;
This commit is contained in:
parent
eb261c5c91
commit
1fbae04bff
1 changed files with 15 additions and 18 deletions
|
@ -1,12 +1,9 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.services.opensmtpd;
|
cfg = config.services.opensmtpd;
|
||||||
conf = pkgs.writeText "smtpd.conf" cfg.serverConfiguration;
|
conf = pkgs.writeText "smtpd.conf" cfg.serverConfiguration;
|
||||||
args = concatStringsSep " " cfg.extraServerArgs;
|
args = lib.concatStringsSep " " cfg.extraServerArgs;
|
||||||
|
|
||||||
sendmail = pkgs.runCommand "opensmtpd-sendmail" { preferLocalBuild = true; } ''
|
sendmail = pkgs.runCommand "opensmtpd-sendmail" { preferLocalBuild = true; } ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
@ -18,29 +15,29 @@ in {
|
||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule [ "services" "opensmtpd" "addSendmailToSystemPath" ] [ "services" "opensmtpd" "setSendmail" ])
|
(lib.mkRenamedOptionModule [ "services" "opensmtpd" "addSendmailToSystemPath" ] [ "services" "opensmtpd" "setSendmail" ])
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
services.opensmtpd = {
|
services.opensmtpd = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether to enable the OpenSMTPD server.";
|
description = "Whether to enable the OpenSMTPD server.";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "opensmtpd" { };
|
package = lib.mkPackageOption pkgs "opensmtpd" { };
|
||||||
|
|
||||||
setSendmail = mkOption {
|
setSendmail = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether to set the system sendmail to OpenSMTPD's.";
|
description = "Whether to set the system sendmail to OpenSMTPD's.";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraServerArgs = mkOption {
|
extraServerArgs = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [];
|
default = [];
|
||||||
example = [ "-v" "-P mta" ];
|
example = [ "-v" "-P mta" ];
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -49,8 +46,8 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
serverConfiguration = mkOption {
|
serverConfiguration = lib.mkOption {
|
||||||
type = types.lines;
|
type = lib.types.lines;
|
||||||
example = ''
|
example = ''
|
||||||
listen on lo
|
listen on lo
|
||||||
accept for any deliver to lmtp localhost:24
|
accept for any deliver to lmtp localhost:24
|
||||||
|
@ -61,8 +58,8 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
procPackages = mkOption {
|
procPackages = lib.mkOption {
|
||||||
type = types.listOf types.package;
|
type = lib.types.listOf lib.types.package;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
Packages to search for filters, tables, queues, and schedulers.
|
Packages to search for filters, tables, queues, and schedulers.
|
||||||
|
@ -78,7 +75,7 @@ in {
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf cfg.enable rec {
|
config = lib.mkIf cfg.enable rec {
|
||||||
users.groups = {
|
users.groups = {
|
||||||
smtpd.gid = config.ids.gids.smtpd;
|
smtpd.gid = config.ids.gids.smtpd;
|
||||||
smtpq.gid = config.ids.gids.smtpq;
|
smtpq.gid = config.ids.gids.smtpq;
|
||||||
|
@ -105,7 +102,7 @@ in {
|
||||||
source = "${cfg.package}/bin/smtpctl";
|
source = "${cfg.package}/bin/smtpctl";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.mail.sendmailSetuidWrapper = mkIf cfg.setSendmail
|
services.mail.sendmailSetuidWrapper = lib.mkIf cfg.setSendmail
|
||||||
(security.wrappers.smtpctl // { program = "sendmail"; });
|
(security.wrappers.smtpctl // { program = "sendmail"; });
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue