Skip to content

Commit

Permalink
fix: add nix module option to specify postgres package
Browse files Browse the repository at this point in the history
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
  • Loading branch information
brianmay committed Sep 28, 2024
1 parent 5737c54 commit e96f3c1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -68,6 +68,12 @@ in {
'';
};

package = mkPackageOption pkgs "postgresql_16" {
extraDescription = ''
The postgresql package to use.
'';
};

user = mkOption {
type = types.str;
default = "teslamate";
Expand Down Expand Up @@ -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`
Expand Down

0 comments on commit e96f3c1

Please sign in to comment.