Skip to content

Commit fc8c0f6

Browse files
authored
Merge pull request flyingcircusio#713 from PhilTaken/flake
Flake-Info patches
2 parents a9c262f + 7fbd3d3 commit fc8c0f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+340
-181
lines changed

doc/src/mailserver.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ HELO name
257257

258258
Frontend IP addresses
259259

260-
: Public IPv4 and/or IPv6 adresses. **A** and **AAAA** queries of the HELO name
260+
: Public IPv4 and/or IPv6 addresses. **A** and **AAAA** queries of the HELO name
261261
must resolve to the frontend IP addresses. Each address must have a **PTR**
262262
record which must resolve exactly to the HELO name.
263263

flake.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
outputs = { self, ...}: let
3+
versions = builtins.fromJSON (builtins.readFile ./versions.json);
4+
nixpkgs = let
5+
inherit (versions.nixpkgs) owner repo rev;
6+
in builtins.getFlake "github:${owner}/${repo}/${rev}";
7+
8+
inherit (nixpkgs) lib;
9+
nixpkgsConfig = import ./nixpkgs-config.nix;
10+
11+
pkgsFor = system: import nixpkgs {
12+
inherit system;
13+
overlays = [ self.overlays.default ];
14+
config = {
15+
inherit (nixpkgsConfig) permittedInsecurePackages;
16+
};
17+
};
18+
19+
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
20+
in {
21+
overlays.default = import ./pkgs/overlay.nix;
22+
nixosModules.default = import ./nixos/default.nix;
23+
24+
legacyPackages = forAllSystems (system: import ./. {
25+
inherit nixpkgs system;
26+
overlays = [ self.overlays.default ];
27+
config = {
28+
inherit (nixpkgsConfig) permittedInsecurePackages;
29+
};
30+
});
31+
32+
packages = forAllSystems (system: let
33+
pkgs = pkgsFor system;
34+
in {
35+
options = let
36+
testConfigFor = system: let
37+
pkgs = pkgsFor system;
38+
versions = import ./versions.nix { inherit pkgs; };
39+
testlib = import ./tests/testlib.nix { inherit (pkgs) lib; };
40+
in lib.nixosSystem {
41+
inherit pkgs system;
42+
specialArgs.nixos-mailserver = versions.nixos-mailserver;
43+
44+
modules = [
45+
{
46+
options.virtualisation.vlans = lib.mkOption {
47+
type = lib.types.anything;
48+
default = [];
49+
};
50+
51+
config.networking.domain = "test.fcio.net";
52+
53+
imports = [
54+
(testlib.fcConfig {
55+
id = 1;
56+
net.fe = true;
57+
extraEncParameters.environment_url = "test.fcio.net";
58+
})
59+
];
60+
}
61+
];
62+
};
63+
64+
rawOpts = lib.optionAttrSetToDocList (testConfigFor system).options;
65+
66+
substSpecial = x:
67+
if lib.isDerivation x then { _type = "derivation"; name = x.name; }
68+
else if builtins.isAttrs x then lib.mapAttrs (name: substSpecial) x
69+
else if builtins.isList x then map substSpecial x
70+
else if lib.isFunction x then "<function>"
71+
else x;
72+
73+
filteredOpts = lib.filter (opt: opt.visible && !opt.internal) rawOpts;
74+
optionsList = lib.flip map filteredOpts
75+
(opt: opt
76+
// lib.optionalAttrs (opt ? example) { example = substSpecial opt.example; }
77+
// lib.optionalAttrs (opt ? default) { default = substSpecial opt.default; }
78+
// lib.optionalAttrs (opt ? type) { type = substSpecial opt.type; }
79+
);
80+
81+
optionsNix = builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList);
82+
finalOptions = lib.mapAttrsToList (name: option: option // { inherit name; }) optionsNix;
83+
in pkgs.writeText "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON finalOptions));
84+
});
85+
};
86+
}

nixos/platform/auditbeat.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ in
1313
type = types.package;
1414
default = pkgs.auditbeat7-oss;
1515
defaultText = "pkgs.auditbeat7-oss";
16-
example = literalExample "pkgs.auditbeat7";
16+
example = literalExpression "pkgs.auditbeat7";
1717
description = ''
1818
The auditbeat package to use.
1919
'';

nixos/platform/default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ in {
8282
};
8383

8484
flyingcircus.enc_services_path = mkOption {
85+
defaultText = "/etc/nixos/services.json";
8586
default = /etc/nixos/services.json;
8687
type = path;
8788
description = "Where to find the ENC services json file.";
@@ -168,7 +169,7 @@ in {
168169
'';
169170
type = types.path;
170171
default = "/etc/local";
171-
example = ./test_cfg;
172+
example = "./test_cfg";
172173
};
173174

174175
flyingcircus.platform = {

nixos/platform/enc.nix

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ with lib;
3535
};
3636

3737
encAddressesPath = mkOption {
38+
defaultText = "/etc/nixos/addresses_srv.json";
3839
default = /etc/nixos/addresses_srv.json;
3940
type = path;
4041
description = "Where to find the address list json file.";
@@ -46,6 +47,7 @@ with lib;
4647
};
4748

4849
encServicesPath = mkOption {
50+
defaultText = "/etc/nixos/services.json";
4951
default = /etc/nixos/services.json;
5052
type = path;
5153
description = "Where to find the ENC services json file.";
@@ -59,6 +61,7 @@ with lib;
5961
};
6062

6163
encServiceClientsPath = mkOption {
64+
defaultText = "/etc/nixos/service_clients.json";
6265
default = /etc/nixos/service_clients.json;
6366
type = path;
6467
description = "Where to find the ENC service clients json file.";
@@ -71,6 +74,7 @@ with lib;
7174
description = "Where to find the releases json file.";
7275
};
7376
systemStatePath = mkOption {
77+
defaultText = "/etc/nixos/system_state.json";
7478
default = /etc/nixos/system_state.json;
7579
type = path;
7680
description = "Where to find the system state json file.";

nixos/platform/filebeat.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ in
118118
type = types.package;
119119
default = pkgs.filebeat7-oss;
120120
defaultText = "pkgs.filebeat7-oss";
121-
example = literalExample "pkgs.filebeat7";
121+
example = literalExpression "pkgs.filebeat7";
122122
description = ''
123123
The filebeat package to use.
124124
'';

nixos/platform/journalbeat.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ in
125125
type = types.package;
126126
default = pkgs.filebeat7-oss;
127127
defaultText = "pkgs.filebeat7-oss";
128-
example = literalExample "pkgs.filebeat7";
128+
example = literalExpression "pkgs.filebeat7";
129129
description = ''
130130
The filebeat package to use.
131131
'';

nixos/platform/static.nix

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ with lib;
2121
};
2222

2323
ceph.fsids = {
24+
"testloc"."testrg" = "7d3bdc42-1d8e-4fcd-952d-e968d4f0cde4";
2425
# These are needed once per cluster.
2526
# Generate a new one via: `uuidgen -t` and record
2627
# it here with the ${location}.${resourcegroup} key

nixos/platform/users.nix

+2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ in
126126
};
127127

128128
userDataPath = lib.mkOption {
129+
defaultText = "/etc/nixos/users.json";
129130
default = /etc/nixos/users.json;
130131
type = path;
131132
description = "Where to find the user json file.";
@@ -137,6 +138,7 @@ in
137138
};
138139

139140
permissionsPath = lib.mkOption {
141+
defaultText = "/etc/nixos/permissions.json";
140142
default = /etc/nixos/permissions.json;
141143
type = path;
142144
description = ''

nixos/roles/antivirus.nix

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ in
1616

1717
listenAddresses = lib.mkOption {
1818
type = lib.types.listOf lib.types.str;
19+
defaultText = "addresses of the interfaces `lo` and `srv`";
1920
default = fclib.network.lo.dualstack.addresses ++
2021
fclib.network.srv.dualstack.addresses;
2122
};

nixos/roles/coturn.nix

+14-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,20 @@ in
5050
config = mkOption {
5151
description = "Platform-configured options";
5252
type = types.attrs;
53-
default = {
53+
defaultText = {
54+
hostname = "\${cfg.hostName}";
55+
alt-listening-port = 3479;
56+
alt-tls-listening-port = 5350;
57+
listening-ips = "the addresses of networks `lo`, `srv` and `fe`";
58+
listening-port = 3478;
59+
lt-cred-mech = false;
60+
no-cli = true;
61+
realm = "\${cfg.hostName}";
62+
tls-listening-port = 5349;
63+
use-auth-secret = true;
64+
extraConfig = [];
65+
};
66+
default = {
5467
hostname = cfg.hostName;
5568
alt-listening-port = 3479;
5669
alt-tls-listening-port = 5350;

nixos/roles/external_net/default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ in
3434
options = {
3535
flyingcircus.roles.external_net = {
3636

37-
enable = lib.mkEnableOption { };
37+
enable = lib.mkEnableOption "fcio external_net role";
3838
supportsContainers = fclib.mkDisableContainerSupport;
3939

4040
vxlan4 = lib.mkOption {
@@ -59,6 +59,7 @@ in
5959

6060
frontendName = lib.mkOption {
6161
type = lib.types.str;
62+
defaultText = "reverse name of the frontend's address";
6263
default = defaultFrontendName;
6364
description = ''
6465
DNS host name for the external network gateway. This is also the name

nixos/roles/external_net/openvpn.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ in
208208
{
209209
options = {
210210
flyingcircus.roles.openvpn = {
211-
enable = lib.mkEnableOption { };
211+
enable = lib.mkEnableOption "fcio openvpn role";
212212
supportsContainers = fclib.mkDisableContainerSupport;
213213

214214
accessNets = lib.mkOption {

nixos/roles/external_net/vxlan.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ in
106106
{
107107
options = with lib; {
108108
flyingcircus.roles.vxlan = {
109-
gateway = mkEnableOption { };
109+
gateway = mkEnableOption "fcio vxlan gateway";
110110

111111
supportsContainers = fclib.mkDisableContainerSupport;
112112

nixos/roles/mailserver.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let
2626
then "${hostName}.fe.${params.location}.${domain}"
2727
else if domain != null then "${hostName}.${domain}" else hostName;
2828
description = ''
29-
FQDN of the mail server's frontend address. IP adresses and
29+
FQDN of the mail server's frontend address. IP addresses and
3030
forward/reverse DNS must match exactly.
3131
'';
3232
example = "mail.example.com";

nixos/roles/memcached.nix

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ in
3434

3535
listenAddresses = lib.mkOption {
3636
type = lib.types.listOf lib.types.str;
37+
defaultText = "the addresses of the networks `lo` and `srv`";
3738
default = fclib.network.lo.dualstack.addresses ++
3839
fclib.network.srv.dualstack.addresses;
3940
};

nixos/roles/mysql.nix

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ in
3737

3838
listenAddresses = lib.mkOption {
3939
type = lib.types.listOf lib.types.str;
40+
defaultText = "the addresses of the networks `lo` and `srv`";
4041
default = fclib.network.lo.dualstack.addresses ++
4142
fclib.network.srv.dualstack.addresses;
4243
};

nixos/roles/statshost/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ in
191191

192192
prometheusListenAddress = mkOption {
193193
type = types.str;
194+
defaultText = "\${head fclib.network.srv.dualstack.addressQuoted}:9090";
194195
default = "${head fclib.network.srv.dualstack.addressesQuoted}:9090";
195196
description = "Prometheus listen address";
196197
};

nixos/roles/webproxy.nix

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ in
4848

4949
listenAddresses = lib.mkOption {
5050
type = lib.types.listOf lib.types.str;
51+
defaultText = "the addresses of the networks `srv` and `lo`";
5152
default = fclib.network.srv.dualstack.addressesQuoted ++
5253
fclib.network.lo.dualstack.addressesQuoted;
5354
};

nixos/services/ceph/client.nix

+31
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,37 @@ in
2121
flyingcircus.services.ceph = {
2222
config = lib.mkOption {
2323
type = lib.types.lines;
24+
defaultText = ''
25+
[global]
26+
pid file = /run/ceph/$type-$id.pid
27+
admin socket = /run/ceph/$cluster-$name.asok
28+
29+
# Needs to correspond with daemon startup ulimit
30+
max open files = 262144
31+
32+
osd pool default min size = 2
33+
osd pool default size = 3
34+
35+
osd pool default pg num = 64
36+
osd pool default pgp num = 64
37+
38+
setuser match path = /srv/ceph/$type/ceph-$id
39+
40+
debug filestore = 4
41+
debug mon = 4
42+
debug osd = 4
43+
debug journal = 4
44+
debug throttle = 4
45+
46+
mon compact on start = true # Keep leveldb small
47+
mon osd down out interval = 900 # Allow 15 min for reboots to happen without backfilling.
48+
mon osd nearfull ratio = .9
49+
50+
mon data = /srv/ceph/mon/$cluster-$id
51+
mon osd allow primary affinity = true
52+
mon pg warn max per osd = 3000
53+
mon pg warn max object skew = 20
54+
'';
2455
default = ''
2556
[global]
2657
fsid = ${fs_id}

nixos/services/haproxy/config-options.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ in {
298298
};
299299
listen = mkOption {
300300
default = {};
301-
example = literalExample ''{
301+
example = literalExpression ''{
302302
http-in = {
303303
binds = [
304304
"127.0.0.1:8002"
@@ -325,7 +325,7 @@ in {
325325
};
326326
backend = mkOption {
327327
default = {};
328-
example = literalExample ''{
328+
example = literalExpression ''{
329329
be = {
330330
servers = [
331331
"localhost localhost:8080"

nixos/services/jitsi/jibri.nix

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ in
162162

163163
configFile = mkOption {
164164
type = types.path;
165+
defaultText = "jibri.conf";
165166
default = "${pkgs.writeText "jibri.conf" (toHOCON cfg.settings)}";
166167
description = ''
167168
Jibri main config file path.
@@ -171,6 +172,7 @@ in
171172

172173
settings = mkOption {
173174
type = types.attrs;
175+
defaultText = {};
174176
default = settings;
175177
description = "Settings used to generate the default config file";
176178
};

nixos/services/jitsi/jicofo.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ in
6262
config = mkOption {
6363
type = attrsOf str;
6464
default = { };
65-
example = literalExample ''
65+
example = literalExpression ''
6666
{
6767
"org.jitsi.jicofo.auth.URL" = "XMPP:jitsi-meet.example.com";
6868
}

0 commit comments

Comments
 (0)