Skip to content

Commit 63d6ab3

Browse files
Merge pull request #218 from NuschtOS/preload-exts-24.11
postgres: fix finalPackage not being there on 24.11
2 parents e4e9b0d + dc3f133 commit 63d6ab3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/postgres.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,13 @@ in
189189
(lib.mkIf cfg.configurePgStatStatements [ "pg_stat_statements" ])
190190
# TODO: upstream, this probably requires a new entry in passthru to pick if the object name doesn't match the plugin name or there are multiple
191191
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/databases/postgresql.nix#L76
192-
(lib.mkIf cfg.preloadAllExtensions (map lib.getName cfg.finalPackage.installedExtensions))
192+
(let
193+
# drop workaround when dropping support for 24.11
194+
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/databases/postgresql.nix#L47-L49
195+
basePackage = if cfg.enableJIT then cfg.package.withJIT else cfg.package.withoutJIT;
196+
postgresPkg = if cfg.extensions == [ ] then basePackage else basePackage.withPackages cfg.extensions;
197+
finalPackage = cfg.finalPackage or postgresPkg;
198+
in lib.mkIf cfg.preloadAllExtensions (map lib.getName finalPackage.installedExtensions))
193199
];
194200
upgrade.stopServices = with config.services; lib.mkMerge [
195201
(lib.mkIf (atuin.enable && atuin.database.createLocally) [ "atuin" ])

0 commit comments

Comments
 (0)