Format project using nixfmt rfc candidate.

This commit is contained in:
Kevin Baensch 2024-11-20 20:32:38 +01:00
parent 1f63817684
commit a9f7fe416f
Signed by: derped
GPG key ID: C0F1D326C7626543
91 changed files with 1347 additions and 1000 deletions

View file

@ -4,12 +4,12 @@
lib,
...
}:
with lib; let
with lib;
let
cfg = config.system.copySysConf;
cfgPath = ../.;
copySysConf =
if !(isStorePath cfgPath)
then
if !(isStorePath cfgPath) then
pkgs.stdenv.mkDerivation rec {
name = "NixOS_Configuration-${version}";
version = commitIdFromGitRepo (cfgPath + "/.git");
@ -20,8 +20,10 @@ with lib; let
cp -R ./. $out
'';
}
else (builtins.toPath ../.);
in {
else
(builtins.toPath ../.);
in
{
options.system.copySysConf = {
enable = mkOption {
type = types.bool;

View file

@ -5,7 +5,8 @@
...
}:
with builtins;
with lib; let
with lib;
let
cfg = config.machine;
pkgsetList = fn.makeOptionTypeList (toString ../pkgsets);
serviceList = fn.makeOptionTypeList (toString ../services);
@ -13,7 +14,12 @@ with lib; let
name = pname;
value = rec {
pkgwrap = mkOption {
type = with types; oneOf [package (listOf package)];
type =
with types;
oneOf [
package
(listOf package)
];
default = fn.pkgFilter cfg.pkgsets."${pname}".pkgs;
description = ''
Package Wrapper for packages using a wrapper function (like python, haskell, ...)
@ -21,18 +27,19 @@ with lib; let
};
pkgs = mkOption {
type = types.unspecified;
default = [];
default = [ ];
description = ''
${pname} package list.
'';
};
};
};
in {
in
{
options.machine = {
pkgs = mkOption {
type = types.listOf (types.enum pkgsetList);
default = ["base"];
default = [ "base" ];
description = ''
The list of metapackages to be installed.
'';
@ -41,14 +48,14 @@ in {
pkgsets = listToAttrs (map pkgOption (lists.filter (v: !(strings.hasInfix "::" v)) pkgsetList));
services = mkOption {
type = types.listOf (types.enum serviceList);
default = [];
default = [ ];
description = ''
List of services to be enabled.
'';
};
conffiles = mkOption {
type = types.listOf types.str;
default = ["zsh"];
default = [ "zsh" ];
description = ''
List of configuration files to be enabled.
'';
@ -77,7 +84,7 @@ in {
};
binaryCaches = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = ''
Adds binary caches to both nix.trustedBinaryCaches and nix.binaryCaches. ("https://cache.nixos.org" is kept by default)
'';
@ -97,28 +104,47 @@ in {
};
extraDomains = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = ''
Extra domains used in various services.
'';
};
mailAccounts = mkOption {
type = types.listOf types.attrs;
default = [];
default = [ ];
description = ''
List of mail account user names.
'';
};
vHosts = mkOption {
type = types.listOf types.attrs;
default = [];
default = [ ];
description = ''
Domain - Service mappings for nginx vHost config.
'';
};
};
imports = [
(mkAliasOptionModule ["machine" "firewall"] ["networking" "firewall"])
(mkAliasOptionModule ["machine" "allowUnfree"] ["nixpkgs" "config" "allowUnfree"])
(mkAliasOptionModule
[
"machine"
"firewall"
]
[
"networking"
"firewall"
]
)
(mkAliasOptionModule
[
"machine"
"allowUnfree"
]
[
"nixpkgs"
"config"
"allowUnfree"
]
)
];
}

View file

@ -68,7 +68,7 @@ buildPythonPackage rec {
meta = with stdenv.lib; {
description = "GNU Mailman, a mailing list management system";
license = licenses.gpl3;
maintainers = with maintainers; [];
maintainers = with maintainers; [ ];
homepage = "http://list.org/";
};
}

View file

@ -14,5 +14,5 @@ buildPythonPackage rec {
sha256 = "1xdfk741pjmz1cm8dsi4n5vq4517i175rm94696m3f7kcgk7xsmp";
};
doCheck = false;
propagatedBuildInputs = [atpublic];
propagatedBuildInputs = [ atpublic ];
}

View file

@ -16,7 +16,10 @@ buildPythonPackage rec {
sha256 = "0k5kjqa3x6gvwwxyzb2vwi1g1i6asm1zw5fivylxz3d583y4kid2";
};
propagatedBuildInputs = [atpublic zope_interface];
propagatedBuildInputs = [
atpublic
zope_interface
];
doCheck = false;
}

View file

@ -15,7 +15,7 @@ buildPythonPackage rec {
sha256 = "1csgds59nx0ann9v2alqr69lakp1cnc1ikmbgn96l6n23js7c2ah";
};
propagatedBuildInputs = [atpublic];
propagatedBuildInputs = [ atpublic ];
doCheck = false;
}

View file

@ -15,7 +15,7 @@ buildPythonPackage rec {
sha256 = "0nzzd6l30ff6cwsrlrb94xzfja4wkyrqv3ydc6cz0hdbr766mmm8";
};
propagatedBuildInputs = [atpublic];
propagatedBuildInputs = [ atpublic ];
doCheck = false;
}

View file

@ -15,7 +15,7 @@ buildPythonPackage rec {
sha256 = "1s7pyvlq06qjrkaw9r6nc290lb095n25ybzgavvy51ygpxkgqxwn";
};
propagatedBuildInputs = [lazr_delegates];
propagatedBuildInputs = [ lazr_delegates ];
doCheck = false;
}

View file

@ -16,7 +16,10 @@ buildPythonPackage rec {
sha256 = "1rdnl85j9ayp8n85l0ciip621j9dcziz5qnmv2m7krgwgcn31vfx";
};
propagatedBuildInputs = [nose zope_interface];
propagatedBuildInputs = [
nose
zope_interface
];
doCheck = false;
}

View file

@ -4,8 +4,9 @@
config,
...
}:
with lib; let
mailman3 = import ./release.nix {};
with lib;
let
mailman3 = import ./release.nix { };
cfg = config.services.mailman3;
usePostgresql = cfg.database.type == "postgresql";
useSqlite = cfg.database.type == "sqlite3";
@ -75,7 +76,8 @@ with lib; let
${cfg.extraConfig}
'';
in {
in
{
options.services.mailman3 = {
enable = mkOption {
type = types.bool;
@ -104,7 +106,11 @@ in {
database = {
type = mkOption {
type = types.enum ["sqlite3" "mysql" "postgres"];
type = types.enum [
"sqlite3"
"mysql"
"postgres"
];
default = "sqlite3";
example = "mysql";
description = ''
@ -273,7 +279,10 @@ in {
mta = {
# TODO: add Sentmail and qmail
type = mkOption {
type = types.enum ["postfix" "exim4"];
type = types.enum [
"postfix"
"exim4"
];
default = "postfix";
example = "exim4";
description = ''
@ -366,42 +375,55 @@ in {
home = cfg.paths.var_dir;
createHome = true;
useDefaultShell = true;
packages = [mailman3.core];
packages = [ mailman3.core ];
};
};
services.postfix.recipientDelimiter = mkIf usePostfix (mkDefault "+");
services.postfix.mapFiles."transport_maps" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_lmtp");
services.postfix.mapFiles."local_recipient_maps" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_lmtp");
services.postfix.mapFiles."relay_domains" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_domains");
services.postfix.mapFiles."transport_maps" = mkIf usePostfix (
mkDefault "${cfg.paths.data_dir}/postfix_lmtp"
);
services.postfix.mapFiles."local_recipient_maps" = mkIf usePostfix (
mkDefault "${cfg.paths.data_dir}/postfix_lmtp"
);
services.postfix.mapFiles."relay_domains" = mkIf usePostfix (
mkDefault "${cfg.paths.data_dir}/postfix_domains"
);
warnings =
optional (cfg.database.password != "")
'' config.services.mailman3.database.password will be stored as plaintext
in the Nix store. Use database.passwordFile instead.'';
warnings = optional (cfg.database.password != "") ''
config.services.mailman3.database.password will be stored as plaintext
in the Nix store. Use database.passwordFile instead.'';
# Create database passwordFile default when password is configured.
services.mailman3.database.passwordFile = mkDefault (toString (pkgs.writeTextFile {
name = "mailman3-database-password";
text = cfg.database.password;
}));
services.mailman3.database.passwordFile = mkDefault (
toString (
pkgs.writeTextFile {
name = "mailman3-database-password";
text = cfg.database.password;
}
)
);
systemd.services.mailman3 = {
description = "GNU Mailing List Manager";
after = ["network.target"] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
wantedBy = ["multi-user.target"];
after = [
"network.target"
] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
wantedBy = [ "multi-user.target" ];
preStart = let
dbpass = fileContents cfg.database.passwordFile;
smtppass = fileContents cfg.mta.smtp_passFile;
in ''
mkdir -p ${cfg.paths.etc_dir}
cp ${configFile} ${cfg.paths.etc_dir}/mailman.cfg
${optionalString (useMysql || usePostgresql) ''
sed -e "s/#dbpass#/${dbpass}/g" -e "s/#smtppass#/${smtppass}/g" -i ${cfg.paths.etc_dir}/mailman.cfg
''}
chmod 640 ${cfg.paths.etc_dir}/mailman.cfg
'';
preStart =
let
dbpass = fileContents cfg.database.passwordFile;
smtppass = fileContents cfg.mta.smtp_passFile;
in
''
mkdir -p ${cfg.paths.etc_dir}
cp ${configFile} ${cfg.paths.etc_dir}/mailman.cfg
${optionalString (useMysql || usePostgresql) ''
sed -e "s/#dbpass#/${dbpass}/g" -e "s/#smtppass#/${smtppass}/g" -i ${cfg.paths.etc_dir}/mailman.cfg
''}
chmod 640 ${cfg.paths.etc_dir}/mailman.cfg
'';
serviceConfig = {
Type = "forking";

View file

@ -1,17 +1,28 @@
{
pkgs ? import <nixpkgs> {},
pkgs ? import <nixpkgs> { },
python3Packages ? pkgs.python3Packages,
}: let
}:
let
mailman3 = {
core = python3Packages.callPackage ./core.nix (with deps; {
inherit aiosmtpd atpublic flufl_bounce flufl_i18n flufl_lock lazr_config;
});
core = python3Packages.callPackage ./core.nix (
with deps;
{
inherit
aiosmtpd
atpublic
flufl_bounce
flufl_i18n
flufl_lock
lazr_config
;
}
);
};
deps = rec {
aiosmtpd = python3Packages.callPackage ./extraPackages/aiosmtpd.nix {
inherit atpublic;
};
atpublic = python3Packages.callPackage ./extraPackages/atpublic.nix {};
atpublic = python3Packages.callPackage ./extraPackages/atpublic.nix { };
flufl_bounce = python3Packages.callPackage ./extraPackages/flufl_bounce.nix {
inherit atpublic;
};
@ -24,7 +35,7 @@
lazr_config = python3Packages.callPackage ./extraPackages/lazr_config.nix {
inherit lazr_delegates;
};
lazr_delegates = python3Packages.callPackage ./extraPackages/lazr_delegates.nix {};
lazr_delegates = python3Packages.callPackage ./extraPackages/lazr_delegates.nix { };
};
in
mailman3
mailman3