diff options
author | happysalada <raphael@megzari.com> | 2023-06-01 21:51:04 -0400 |
---|---|---|
committer | Yt <happysalada@tuta.io> | 2023-06-07 05:35:09 -0400 |
commit | d804ca626ac8914ed9218014a3c499ea1d8b4342 (patch) | |
tree | d67a31902bb139ee5c0910cecea192ee185f88e0 /nixos | |
parent | 4bcb4ea1582a6bbf65871dc81800e0e2a59baa4a (diff) |
nixos/atuin: add database.createLocally
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/atuin.nix | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/atuin.nix b/nixos/modules/services/misc/atuin.nix index c603042fb306..202bd4dfca11 100644 --- a/nixos/modules/services/misc/atuin.nix +++ b/nixos/modules/services/misc/atuin.nix @@ -46,6 +46,13 @@ in description = mdDoc "Open ports in the firewall for the atuin server."; }; + database = { + createLocally = mkOption { + type = types.bool; + default = true; + description = lib.mdDoc "Create the database and database user locally."; + }; + }; }; }; @@ -65,7 +72,8 @@ in systemd.services.atuin = { description = "atuin server"; - after = [ "network.target" "postgresql.service" ]; + requires = lib.optionals cfg.database.createLocally [ "postgresql.service" ]; + after = [ "network.target" ] ++ lib.optionals cfg.database.createLocally [ "postgresql.service" ] ; wantedBy = [ "multi-user.target" ]; serviceConfig = { @@ -80,7 +88,7 @@ in ATUIN_PORT = toString cfg.port; ATUIN_MAX_HISTORY_LENGTH = toString cfg.maxHistoryLength; ATUIN_OPEN_REGISTRATION = boolToString cfg.openRegistration; - ATUIN_DB_URI = "postgresql:///atuin"; + ATUIN_DB_URI = mkIf cfg.database.createLocally "postgresql:///atuin"; ATUIN_PATH = cfg.path; ATUIN_CONFIG_DIR = "/run/atuin"; # required to start, but not used as configuration is via environment variables }; |