From e96f3c158525523e6402b50cfb6c075d400226b5 Mon Sep 17 00:00:00 2001 From: Brian May Date: Sat, 28 Sep 2024 08:33:00 +1000 Subject: [PATCH] fix: add nix module option to specify postgres package Without this upgrading postgres - which must be done manually - is likely to be painful. For postgresql upgrade instructions see https://nixos.org/manual/nixos/stable/#module-services-postgres-upgrading --- module.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/module.nix b/module.nix index 57c129b7f7..6837e64170 100644 --- a/module.nix +++ b/module.nix @@ -4,7 +4,7 @@ let teslamate = self.packages.${pkgs.system}.default; cfg = config.services.teslamate; - inherit (lib) mkEnableOption mkOption types mkIf mkMerge getExe literalExpression; + inherit (lib) mkPackageOption mkEnableOption mkOption types mkIf mkMerge getExe literalExpression; in { options.services.teslamate = { enable = mkEnableOption "Teslamate"; @@ -68,6 +68,12 @@ in { ''; }; + package = mkPackageOption pkgs "postgresql_16" { + extraDescription = '' + The postgresql package to use. + ''; + }; + user = mkOption { type = types.str; default = "teslamate"; @@ -187,8 +193,7 @@ in { (mkIf cfg.postgres.enable_server { services.postgresql = { enable = true; - package = pkgs.postgresql_16; - inherit (cfg.postgres) port; + inherit (cfg.postgres) port package; initialScript = pkgs.writeText "teslamate-psql-init" '' \set password `echo $DATABASE_PASS`