diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-10 01:22:16 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-10 01:22:16 +0200 |
commit | 9f16e659f129dd8acab7d086ef9822673a01ba06 (patch) | |
tree | e457a3aa743bf31f67d09ee9569bbda3cd5bf152 | |
parent | a071d8a6af7b8130047b3997c34b15f71089a4e5 (diff) | |
download | Nix-9f16e659f129dd8acab7d086ef9822673a01ba06.tar.gz Nix-9f16e659f129dd8acab7d086ef9822673a01ba06.tar.zst Nix-9f16e659f129dd8acab7d086ef9822673a01ba06.zip |
Stop using overlays in the middle of modules
-rw-r--r-- | modules/private/databases/default.nix | 4 | ||||
-rw-r--r-- | modules/private/databases/postgresql_replication.nix | 13 | ||||
-rw-r--r-- | modules/private/mail/postfix.nix | 3 | ||||
-rw-r--r-- | modules/private/mail/relay.nix | 3 | ||||
-rw-r--r-- | modules/private/monitoring/default.nix | 7 | ||||
-rw-r--r-- | modules/private/system/backup-2.nix | 2 | ||||
-rw-r--r-- | overlays/databases/postgresql/default.nix | 2 | ||||
-rw-r--r-- | overlays/default.nix | 1 | ||||
-rw-r--r-- | overlays/postfix/default.nix | 3 |
9 files changed, 21 insertions, 17 deletions
diff --git a/modules/private/databases/default.nix b/modules/private/databases/default.nix index c4a023a..6cd6feb 100644 --- a/modules/private/databases/default.nix +++ b/modules/private/databases/default.nix | |||
@@ -10,10 +10,6 @@ in | |||
10 | }; | 10 | }; |
11 | }; | 11 | }; |
12 | 12 | ||
13 | config.nixpkgs.overlays = lib.mkIf cfg.enable [ (self: super: { | ||
14 | postgresql = self.postgresql_11_custom; | ||
15 | }) ]; | ||
16 | |||
17 | config.myServices.databases = lib.mkIf cfg.enable { | 13 | config.myServices.databases = lib.mkIf cfg.enable { |
18 | mariadb = { | 14 | mariadb = { |
19 | enable = true; | 15 | enable = true; |
diff --git a/modules/private/databases/postgresql_replication.nix b/modules/private/databases/postgresql_replication.nix index 7172c5e..6ac2455 100644 --- a/modules/private/databases/postgresql_replication.nix +++ b/modules/private/databases/postgresql_replication.nix | |||
@@ -11,6 +11,13 @@ in | |||
11 | Base path to put the replications | 11 | Base path to put the replications |
12 | ''; | 12 | ''; |
13 | }; | 13 | }; |
14 | mainPackage = lib.mkOption { | ||
15 | type = lib.types.package; | ||
16 | default = pkgs.postgresql; | ||
17 | description = '' | ||
18 | Postgresql package available in shell | ||
19 | ''; | ||
20 | }; | ||
14 | hosts = lib.mkOption { | 21 | hosts = lib.mkOption { |
15 | default = {}; | 22 | default = {}; |
16 | description = '' | 23 | description = '' |
@@ -43,10 +50,6 @@ in | |||
43 | }; | 50 | }; |
44 | 51 | ||
45 | config = lib.mkIf cfg.enable { | 52 | config = lib.mkIf cfg.enable { |
46 | nixpkgs.overlays = [ (self: super: { | ||
47 | postgresql = self.postgresql_11_custom; | ||
48 | }) ]; | ||
49 | |||
50 | users.users.postgres = { | 53 | users.users.postgres = { |
51 | name = "postgres"; | 54 | name = "postgres"; |
52 | uid = config.ids.uids.postgres; | 55 | uid = config.ids.uids.postgres; |
@@ -57,7 +60,7 @@ in | |||
57 | extraGroups = [ "keys" ]; | 60 | extraGroups = [ "keys" ]; |
58 | }; | 61 | }; |
59 | users.groups.postgres.gid = config.ids.gids.postgres; | 62 | users.groups.postgres.gid = config.ids.gids.postgres; |
60 | environment.systemPackages = [ pkgs.postgresql ]; | 63 | environment.systemPackages = [ cfg.mainPackage ]; |
61 | 64 | ||
62 | secrets.keys = lib.flatten (lib.mapAttrsToList (name: hcfg: [ | 65 | secrets.keys = lib.flatten (lib.mapAttrsToList (name: hcfg: [ |
63 | { | 66 | { |
diff --git a/modules/private/mail/postfix.nix b/modules/private/mail/postfix.nix index 92fa580..985d4af 100644 --- a/modules/private/mail/postfix.nix +++ b/modules/private/mail/postfix.nix | |||
@@ -171,9 +171,6 @@ | |||
171 | 171 | ||
172 | networking.firewall.allowedTCPPorts = [ 25 465 587 ]; | 172 | networking.firewall.allowedTCPPorts = [ 25 465 587 ]; |
173 | 173 | ||
174 | nixpkgs.overlays = [ (self: super: { | ||
175 | postfix = super.postfix.override { withMySQL = true; }; | ||
176 | }) ]; | ||
177 | users.users."${config.services.postfix.user}".extraGroups = [ "keys" ]; | 174 | users.users."${config.services.postfix.user}".extraGroups = [ "keys" ]; |
178 | services.filesWatcher.postfix = { | 175 | services.filesWatcher.postfix = { |
179 | restart = true; | 176 | restart = true; |
diff --git a/modules/private/mail/relay.nix b/modules/private/mail/relay.nix index c6231aa..d29ae75 100644 --- a/modules/private/mail/relay.nix +++ b/modules/private/mail/relay.nix | |||
@@ -89,9 +89,6 @@ | |||
89 | 89 | ||
90 | networking.firewall.allowedTCPPorts = [ 25 ]; | 90 | networking.firewall.allowedTCPPorts = [ 25 ]; |
91 | 91 | ||
92 | nixpkgs.overlays = [ (self: super: { | ||
93 | postfix = super.postfix.override { withMySQL = true; }; | ||
94 | }) ]; | ||
95 | users.users."${config.services.postfix.user}".extraGroups = [ "keys" ]; | 92 | users.users."${config.services.postfix.user}".extraGroups = [ "keys" ]; |
96 | services.filesWatcher.postfix = { | 93 | services.filesWatcher.postfix = { |
97 | restart = true; | 94 | restart = true; |
diff --git a/modules/private/monitoring/default.nix b/modules/private/monitoring/default.nix index 8b45d47..0586567 100644 --- a/modules/private/monitoring/default.nix +++ b/modules/private/monitoring/default.nix | |||
@@ -11,6 +11,11 @@ let | |||
11 | pkgs.mailutils | 11 | pkgs.mailutils |
12 | ]} | 12 | ]} |
13 | ''; | 13 | ''; |
14 | postgresqlBinary = if config.myServices.databasesReplication.postgresql.enable | ||
15 | then config.myServices.databasesReplication.postgresql.mainPackage | ||
16 | else if config.myServices.databases.enable | ||
17 | then config.myServices.databases.postgresql.package | ||
18 | else pkgs.postgresql; | ||
14 | myplugins = pkgs.runCommand "buildplugins" { | 19 | myplugins = pkgs.runCommand "buildplugins" { |
15 | buildInputs = [ pkgs.makeWrapper pkgs.perl ]; | 20 | buildInputs = [ pkgs.makeWrapper pkgs.perl ]; |
16 | } '' | 21 | } '' |
@@ -28,7 +33,7 @@ let | |||
28 | pkgs.gnugrep pkgs.gawk pkgs.procps-ng | 33 | pkgs.gnugrep pkgs.gawk pkgs.procps-ng |
29 | ]} | 34 | ]} |
30 | wrapProgram $out/check_postgres_replication --prefix PATH : ${lib.makeBinPath [ | 35 | wrapProgram $out/check_postgres_replication --prefix PATH : ${lib.makeBinPath [ |
31 | pkgs.postgresql | 36 | postgresqlBinary |
32 | ]} | 37 | ]} |
33 | wrapProgram $out/check_redis_replication --prefix PATH : ${lib.makeBinPath [ | 38 | wrapProgram $out/check_redis_replication --prefix PATH : ${lib.makeBinPath [ |
34 | pkgs.gnugrep pkgs.coreutils pkgs.redis | 39 | pkgs.gnugrep pkgs.coreutils pkgs.redis |
diff --git a/modules/private/system/backup-2.nix b/modules/private/system/backup-2.nix index 3d263f5..a49c374 100644 --- a/modules/private/system/backup-2.nix +++ b/modules/private/system/backup-2.nix | |||
@@ -66,10 +66,12 @@ | |||
66 | postgresql = { | 66 | postgresql = { |
67 | enable = true; | 67 | enable = true; |
68 | base = "/backup2"; | 68 | base = "/backup2"; |
69 | mainPackage = pkgs.postgresql; | ||
69 | hosts = { | 70 | hosts = { |
70 | eldiron = { | 71 | eldiron = { |
71 | slot = "backup_2"; | 72 | slot = "backup_2"; |
72 | connection = "postgresql://backup-2:${config.hostEnv.ldap.password}@eldiron.immae.eu"; | 73 | connection = "postgresql://backup-2:${config.hostEnv.ldap.password}@eldiron.immae.eu"; |
74 | package = pkgs.postgresql; | ||
73 | }; | 75 | }; |
74 | }; | 76 | }; |
75 | }; | 77 | }; |
diff --git a/overlays/databases/postgresql/default.nix b/overlays/databases/postgresql/default.nix index ae58987..50d9496 100644 --- a/overlays/databases/postgresql/default.nix +++ b/overlays/databases/postgresql/default.nix | |||
@@ -1,5 +1,5 @@ | |||
1 | self: super: rec { | 1 | self: super: rec { |
2 | postgresql_11_custom = super.postgresql_11.overrideAttrs(old: { | 2 | postgresql = super.postgresql_11.overrideAttrs(old: { |
3 | # datadir in /var/lib/postgresql is named after psqlSchema | 3 | # datadir in /var/lib/postgresql is named after psqlSchema |
4 | passthru = old.passthru // { psqlSchema = "11.0"; }; | 4 | passthru = old.passthru // { psqlSchema = "11.0"; }; |
5 | configureFlags = old.configureFlags ++ [ "--with-pam" ]; | 5 | configureFlags = old.configureFlags ++ [ "--with-pam" ]; |
diff --git a/overlays/default.nix b/overlays/default.nix index 881083d..b3bc8ca 100644 --- a/overlays/default.nix +++ b/overlays/default.nix | |||
@@ -17,6 +17,7 @@ | |||
17 | nixops = import ./nixops; | 17 | nixops = import ./nixops; |
18 | pass = import ./pass; | 18 | pass = import ./pass; |
19 | pelican = import ./pelican; | 19 | pelican = import ./pelican; |
20 | postfix = import ./postfix; | ||
20 | postgresql = import ./databases/postgresql; | 21 | postgresql = import ./databases/postgresql; |
21 | s6 = import ./s6; | 22 | s6 = import ./s6; |
22 | sc-im = import ./sc-im; | 23 | sc-im = import ./sc-im; |
diff --git a/overlays/postfix/default.nix b/overlays/postfix/default.nix new file mode 100644 index 0000000..55b8312 --- /dev/null +++ b/overlays/postfix/default.nix | |||
@@ -0,0 +1,3 @@ | |||
1 | self: super: { | ||
2 | postfix = super.postfix.override { withMySQL = true; }; | ||
3 | } | ||