diff options
Diffstat (limited to 'config/pjournal.nix')
-rw-r--r-- | config/pjournal.nix | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/config/pjournal.nix b/config/pjournal.nix deleted file mode 100644 index 06e93d0..0000000 --- a/config/pjournal.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -let cfg = config.services.pjournal; -in { - options = { - services.pjournal = { - enable = mkOption { - type = types.bool; - default = false; - }; - - package = mkOption { - type = types.package; - default = pkgs.callPackage ../pkgs/pjournal/default.nix { }; - }; - - base_url = mkOption { - type = types.str; - default = "http://localhost:8080"; - }; - - port = mkOption { - type = types.int; - default = 8080; - }; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = [ cfg.package ]; - - services.postgresql = { - enable = true; - 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"; }; - script = '' - # This will fail the first time. Run pjournal init to initialize - # the database. - ${cfg.package}/bin/pjournal \ - --database-url postgres://pjournal@/pjournal \ - --port ${toString cfg.port} \ - --base-url ${cfg.base_url} - ''; - serviceConfig = { User = "pjournal"; }; - }; - - }; -} |