summaryrefslogtreecommitdiff
path: root/config/pjournal.nix
diff options
context:
space:
mode:
Diffstat (limited to 'config/pjournal.nix')
-rw-r--r--config/pjournal.nix36
1 files changed, 12 insertions, 24 deletions
diff --git a/config/pjournal.nix b/config/pjournal.nix
index 7214537..06e93d0 100644
--- a/config/pjournal.nix
+++ b/config/pjournal.nix
@@ -1,9 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
-let
- cfg = config.services.pjournal;
-in
-{
+let cfg = config.services.pjournal;
+in {
options = {
services.pjournal = {
enable = mkOption {
@@ -13,7 +11,7 @@ in
package = mkOption {
type = types.package;
- default = pkgs.callPackage ../pkgs/pjournal/default.nix {};
+ default = pkgs.callPackage ../pkgs/pjournal/default.nix { };
};
base_url = mkOption {
@@ -29,30 +27,22 @@ in
};
config = mkIf cfg.enable {
- environment.systemPackages = [
- cfg.package
- ];
+ environment.systemPackages = [ cfg.package ];
services.postgresql = {
enable = true;
- ensureDatabases = ["pjournal"];
- ensureUsers = [
- {
- name = "pjournal";
- ensurePermissions = {
- "DATABASE pjournal" = "ALL PRIVILEGES";
- };
- }
- ];
+ ensureDatabases = [ "pjournal" ];
+ ensureUsers = [{
+ name = "pjournal";
+ ensurePermissions = { "DATABASE pjournal" = "ALL PRIVILEGES"; };
+ }];
};
systemd.services.pjournal = {
description = "pjournal instance";
after = [ "multi-user.target" "postgresql.service" ];
- wantedBy = ["multi-user.target"];
- environment = {
- RUST_BACKTRACE = "1";
- };
+ wantedBy = [ "multi-user.target" ];
+ environment = { RUST_BACKTRACE = "1"; };
script = ''
# This will fail the first time. Run pjournal init to initialize
# the database.
@@ -61,9 +51,7 @@ in
--port ${toString cfg.port} \
--base-url ${cfg.base_url}
'';
- serviceConfig = {
- User = "pjournal";
- };
+ serviceConfig = { User = "pjournal"; };
};
};