From 026d5f813b7cbe530cb963e98956d6a9a534d1cc Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Fri, 27 Sep 2024 18:56:13 +0200 Subject: [PATCH] atuin: run as daemon --- home/common/atuin.nix | 42 +++++++++++++++++++++++++++++++++++++++++- home/dln/home.nix | 10 ++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/home/common/atuin.nix b/home/common/atuin.nix index e197b73..720459b 100644 --- a/home/common/atuin.nix +++ b/home/common/atuin.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: { programs.atuin = { enable = true; @@ -16,6 +16,12 @@ sync_address = "https://atuin.patagia.dev"; sync.records = true; + daemon = { + enabled = true; + socket_path = "/run/user/1000/atuin.socket"; # FIXME: remove hard coded uid + systemd_socket = true; + }; + stats.common_subcommands = [ "cargo" "git" @@ -37,4 +43,38 @@ ]; }; }; + + systemd.user.services.atuin-daemon = { + Unit = { + Description = "atuin shell history daemon"; + Requires = [ "atuin-daemon.socket" ]; + }; + Service = { + ExecStart = "${lib.getExe pkgs.atuin} daemon"; + Environment = [ "ATUIN_LOG=info" ]; + Restart = "on-failure"; + RestartSteps = 5; + RestartMaxDelaySec = 10; + }; + Install = { + Also = [ "atuin-daemon.socket" ]; + WantedBy = [ "default.target" ]; + }; + }; + + systemd.user.sockets.atuin-daemon = { + Unit = { + Description = "Unix socket activation for atuin shell history daemon"; + }; + + Socket = { + ListenStream = "%t/atuin.socket"; + SocketMode = "0600"; + RemoveOnStop = true; + }; + + Install = { + WantedBy = [ "sockets.target" ]; + }; + }; } diff --git a/home/dln/home.nix b/home/dln/home.nix index c7e9ab4..d2487f5 100644 --- a/home/dln/home.nix +++ b/home/dln/home.nix @@ -15,9 +15,19 @@ in }; programs.atuin.settings = { + show_tabs = false; + cwd_filter = [ "^~/media" "^/home/dln/media" + "^/tmp" + ]; + + history_filter = [ + "^kubectl create secret.*--from-literal" + "^kubectl delete ns" + "^kubectl delete namespace" + "^talosctl reset" ]; };