diff options
author | makefu <github@syntax-fehler.de> | 2022-12-12 19:44:00 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2022-12-12 19:44:00 +0100 |
commit | 6eb5e44b7e5bdc8b1b3b5ffe40c146841f7afd10 (patch) | |
tree | f706bf7c3c7a289f680ac329caa2b578e5145a56 /lass/2configs/atuin-server.nix | |
parent | 96e934dc8a353cff91ef824f6a125ed49996d058 (diff) | |
parent | 3884243448869bdf09f6434b385e532c7c26ae88 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/2configs/atuin-server.nix')
-rw-r--r-- | lass/2configs/atuin-server.nix | 38 |
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 ]; +} |