atuin: run as daemon

This commit is contained in:
Daniel Lundin 2024-09-27 18:56:13 +02:00
parent 52fe78851b
commit 026d5f813b
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
2 changed files with 51 additions and 1 deletions

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { lib, pkgs, ... }:
{ {
programs.atuin = { programs.atuin = {
enable = true; enable = true;
@ -16,6 +16,12 @@
sync_address = "https://atuin.patagia.dev"; sync_address = "https://atuin.patagia.dev";
sync.records = true; sync.records = true;
daemon = {
enabled = true;
socket_path = "/run/user/1000/atuin.socket"; # FIXME: remove hard coded uid
systemd_socket = true;
};
stats.common_subcommands = [ stats.common_subcommands = [
"cargo" "cargo"
"git" "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" ];
};
};
} }

View file

@ -15,9 +15,19 @@ in
}; };
programs.atuin.settings = { programs.atuin.settings = {
show_tabs = false;
cwd_filter = [ cwd_filter = [
"^~/media" "^~/media"
"^/home/dln/media" "^/home/dln/media"
"^/tmp"
];
history_filter = [
"^kubectl create secret.*--from-literal"
"^kubectl delete ns"
"^kubectl delete namespace"
"^talosctl reset"
]; ];
}; };