]> Git — Sourcephile - sourcephile-nix.git/blob - install/logical/friot.nix
update
[sourcephile-nix.git] / install / logical / friot.nix
1 {pkgs, lib, config, system, ...}:
2 let inherit (builtins.extraBuiltins) pass;
3 inherit (lib) types;
4 inherit (config.services) dovecot2;
5 userPass = name: pass ("${config.networking.domain}/${config.networking.hostName}/"+name);
6 in {
7 imports = [
8 <nixsys/install/modules.nix>
9 friot/dovecot.nix
10 friot/gitolite.nix
11 friot/nginx.nix
12 friot/nsd.nix
13 friot/postfix.nix
14 friot/postgrey.nix
15 friot/rmilter.nix
16 friot/shorewall.nix
17 ];
18 options = {
19 enable = lib.mkEnableOption "friot";
20 networking.zones = lib.mkOption {
21 type = types.attrsOf (types.submodule ({zone, ...}: {
22 options = {
23 iface = lib.mkOption {
24 type = types.str;
25 description = "Interface name.";
26 example = "eth0";
27 };
28 ipv4 = lib.mkOption {
29 type = types.str;
30 description = "Static IPv4 address of the machine.";
31 example = "1.2.3.4";
32 };
33 ipv6 = lib.mkOption {
34 type = types.str;
35 description = "Static IPv6 address of the machine.";
36 example = "fe80::1";
37 };
38 };
39 }));
40 };
41 };
42 config = {
43 networking = {
44 domain = "commonade.coop";
45 };
46 #fqdn = "machine1.logic.coop";
47 users.mutableUsers = false;
48 users.users = {
49 root.initialPassword = userPass "root";
50 root.password = config.users.users.root.initialPassword;
51 julm = {
52 uid = 4242;
53 extraGroups = [ "sudo" ];
54 description = "Julien Moutinho";
55 home = "/home/julm";
56 shell = lib.mkDefault config.users.defaultUserShell;
57 group = "julm"; # FIXME: unknown group
58 initialPassword = userPass "julm";
59 password = config.users.users.julm.initialPassword;
60 };
61 };
62
63 services = {
64 nixosManual = {
65 enable = false; # NOTE: useless on this machine, and CPU intensive.
66 };
67 disnix = {
68 enable = false;
69 };
70 openssh = {
71 enable = true;
72 };
73 openldap = {
74 enable = true;
75 #declarativeContents = ''
76 # dn: dc=example,dc=org
77 # objectClass: domain
78 # dc: example
79 #
80 # dn: ou=users,dc=example,dc=org
81 # objectClass = organizationalUnit
82 # ou: users
83 #
84 # # ...
85 #'';
86 };
87 gitea = {
88 enable = false;
89 };
90 dovecot2 = {
91 #debug = true;
92 };
93 journald = {
94 extraConfig = ''
95 SystemMaxUse=50M
96 '';
97 };
98 x509 = {
99 domains =
100 [ "www.${config.networking.domain}" ] ++
101 [ "git.${config.networking.domain}" ] ++
102 builtins.attrNames dovecot2.domains;
103 };
104 postfix.aliases = {
105 "root@${config.networking.domain}" = [ "test@${config.networking.domain}" ];
106 "postmaster@${config.networking.domain}" = [ "test@${config.networking.domain}" ];
107 "abuse@${config.networking.domain}" = [ "test@${config.networking.domain}" ];
108 };
109 dovecot2.domains = {
110 "${config.networking.domain}" = {
111 accounts = {
112 test = {
113 password = builtins.extraBuiltins.pass "${config.networking.domain}/dovecot2/test";
114 # "${config.networking.domain}/dovecot2/test";
115 # "{SSHA512}uyjL1KYx4z7HpfNvnKzuVxpMLD2KVueGGBvOcj7AF1EZCTVhT++IIKUVOC4xpZtWdqVD0OVmZqgYr2qpn/3t3Aj4oU0=";
116 aliases = ["test-alias@${config.networking.domain}"];
117 quota = "512M";
118 };
119 };
120 };
121 };
122 };
123 environment = {
124 systemPackages = with pkgs; [
125 htop
126 tree
127 vim
128 postgresql
129 dnsutils
130 tcpdump
131 #mysql
132 #procmail
133 postgrey
134 duplicity
135 pypolicyd-spf
136 unbound
137 nsd
138 dropbear
139 cryptsetup
140 openssl
141 gitolite
142 postgresql
143 cgit
144 openldap
145 #mail
146 #sympa
147 multitail
148 inetutils
149 cgit
150 ncdu
151 ];
152 };
153 };
154 }