summaryrefslogtreecommitdiffstats
path: root/lass/2configs/atuin-server.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-11-22 19:38:36 +0100
committertv <tv@krebsco.de>2022-11-22 19:38:36 +0100
commit1c4e27473c46faf4b4a4c800cb29cdabf73f716f (patch)
treed9ec3e9b4a2e77f9e8baf2e8601a5cc9439131eb /lass/2configs/atuin-server.nix
parent12ce60ff1435a71ee4cf0431223c129010e7df73 (diff)
parentfef385511d07c1ea5be1eae4fd8dd7eba563ab2c (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'lass/2configs/atuin-server.nix')
-rw-r--r--lass/2configs/atuin-server.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/lass/2configs/atuin-server.nix b/lass/2configs/atuin-server.nix
new file mode 100644
index 000000000..ad959a311
--- /dev/null
+++ b/lass/2configs/atuin-server.nix
@@ -0,0 +1,38 @@
+{ config, lib, pkgs, ... }:
+{
+ services.postgresql = {
+ enable = true;
+ dataDir = "/var/state/postgresql/${config.services.postgresql.package.psqlSchema}";
+ ensureDatabases = [ "atuin" ];
+ ensureUsers = [{
+ name = "atuin";
+ ensurePermissions."DATABASE atuin" = "ALL PRIVILEGES";
+ }];
+ };
+ systemd.tmpfiles.rules = [
+ "d /var/state/postgresql 0700 postgres postgres -"
+ ];
+ users.groups.atuin = {};
+ users.users.atuin = {
+ uid = pkgs.stockholm.lib.genid_uint31 "atuin";
+ isSystemUser = true;
+ group = "atuin";
+ home = "/run/atuin";
+ createHome = true;
+ };
+
+ systemd.services.atuin = {
+ wantedBy = [ "multi-user.target" ];
+ environment = {
+ ATUIN_HOST = "0.0.0.0";
+ ATUIN_PORT = "8888";
+ ATUIN_OPEN_REGISTRATION = "true";
+ ATUIN_DB_URI = "postgres:///atuin";
+ };
+ serviceConfig = {
+ User = "atuin";
+ ExecStart = "${pkgs.atuin}/bin/atuin server start";
+ };
+ };
+ networking.firewall.allowedTCPPorts = [ 8888 ];
+}