lol

nixos/maddy: add package option (#396535)

authored by

Felix Bühler and committed by
GitHub
7b3170d6 e1b21eaa

+9 -7
+9 -7
nixos/modules/services/mail/maddy.nix
··· 143 143 144 144 enable = lib.mkEnableOption "Maddy, a free an open source mail server"; 145 145 146 + package = lib.mkPackageOption pkgs "maddy" { }; 147 + 146 148 user = lib.mkOption { 147 149 default = "maddy"; 148 150 type = with lib.types; uniq str; ··· 386 388 387 389 systemd = { 388 390 389 - packages = [ pkgs.maddy ]; 391 + packages = [ cfg.package ]; 390 392 services = { 391 393 maddy = { 392 394 serviceConfig = { ··· 402 404 script = '' 403 405 ${lib.optionalString (cfg.ensureAccounts != [ ]) '' 404 406 ${lib.concatMapStrings (account: '' 405 - if ! ${pkgs.maddy}/bin/maddyctl imap-acct list | grep "${account}"; then 406 - ${pkgs.maddy}/bin/maddyctl imap-acct create ${account} 407 + if ! ${cfg.package}/bin/maddyctl imap-acct list | grep "${account}"; then 408 + ${cfg.package}/bin/maddyctl imap-acct create ${account} 407 409 fi 408 410 '') cfg.ensureAccounts} 409 411 ''} 410 412 ${lib.optionalString (cfg.ensureCredentials != { }) '' 411 413 ${lib.concatStringsSep "\n" ( 412 - lib.mapAttrsToList (name: cfg: '' 413 - if ! ${pkgs.maddy}/bin/maddyctl creds list | grep "${name}"; then 414 - ${pkgs.maddy}/bin/maddyctl creds create --password $(cat ${lib.escapeShellArg cfg.passwordFile}) ${name} 414 + lib.mapAttrsToList (name: credentials: '' 415 + if ! ${cfg.package}/bin/maddyctl creds list | grep "${name}"; then 416 + ${cfg.package}/bin/maddyctl creds create --password $(cat ${lib.escapeShellArg credentials.passwordFile}) ${name} 415 417 fi 416 418 '') cfg.ensureCredentials 417 419 )} ··· 486 488 }; 487 489 488 490 environment.systemPackages = [ 489 - pkgs.maddy 491 + cfg.package 490 492 ]; 491 493 }; 492 494 }