the home site for me: also iteration 3 or 4 of my site
1+++
2title = "Musings about Atuin"
3date = 2025-04-24
4slug = "atuin"
5description = "its a bit tricky on nix, but it's sooo worth it"
6
7[taxonomies]
8tags = ["shell", "nix", "cool stuff"]
9+++
10
11I've been on the fence about using [Atuin](https://atuin.sh) for about a month now. I heard about it from [Ellie](https://ellie.wtf) on bluesky and initially didn't bother setting it up since I didn't really care about whether my shell history was synced across devices as I'm only using one main device (framework 13 🔥) rn. I saw a repost of Ellie's about Atuin Desktop today and that finally pushed me over the edge to take the time to figure out how to get it setup with nix.
12
13<!-- more -->
14
15{{ bluesky(post="https://bsky.app/profile/ellie.wtf/post/3lng5ig2o722z") }}
16
17And it wasn't that hard! Atuin is published on nixpkgs or can be installed via a flake and there is a home manager module for it too! Once you get past actual installation and into using agenix to declaritively manage your secrets then it gets annoying (proly mainly because i'm still pretty stupid when it comes to nix lol).
18
19The first bit is that to access age secrets in home manager you have to actually export them in home manager (🤯) and you can't just use the version from your `configuration.nix`. The second bit is that you **also** need to export the age file in your `configuration.nix` (that took me a solid half hour to figure out :uw_embarrassed:). The third and final thing however is that you can't just save the secret and key files with agenix like normal but you have to strip the line endings from them 😭.
20
21Here's the basic scaffolding you'll need for your Nix configuration:
22
23> configuration.nix
24```nix
25{ config, pkgs, ... }:
26
27{
28 # ... configuration options
29
30 age.secrets = {
31 atuin-session = {
32 file = ../secrets/atuin-session.age;
33 mode = "0444";
34 };
35 atuin-key = {
36 file = ../secrets/atuin-key.age;
37 mode = "0444";
38 };
39 };
40
41 # ... more configuration options
42}
43```
44
45and then the home-manager bit
46
47> shell.nix in home manager
48```nix
49{ config, pkgs, ... }:
50
51{
52 # ... some home-manager modules and configs
53
54 programs.atuin = {
55 enable = true;
56 settings = {
57 auto_sync = true;
58 sync_frequency = "5m";
59 sync_address = "https://api.atuin.sh";
60 search_mode = "fuzzy";
61 session_path = config.age.secrets."atuin-session".path;
62 key_path = config.age.secrets."atuin-key".path;
63 };
64 };
65
66 age.secrets = {
67 atuin-session = {
68 file = ../../secrets/atuin-session.age;
69 };
70 atuin-key = {
71 file = ../../secrets/atuin-key.age;
72 };
73 };
74
75 # ... even more home-manager configurations 😅
76}
77```
78
79Now saving the secrets with agenix is not particularly tricky you just have to know that this is an option. Run `agenix -e atuin-session.age` and then paste in the session from `~/.local/share/atuin/session` and then instead of just saving like normal you need to run `:set binary` and then `:set noeol` and then you can save the file like normal.
80
81Anyways now i'm enjoying my stats and it's on to the next project (proly [serif.blue](https://tangled.sh/@dunkirk.sh/serif) 👀)
82
83```
84> atuin stats
85[▮▮▮▮▮▮▮▮▮▮] 1209 gc
86[▮▮▮▮ ] 495 curl
87[▮▮ ] 348 bun
88[▮▮ ] 329 cat
89[▮ ] 222 z
90[▮ ] 200 g
91[▮ ] 162 nix-shell
92[▮ ] 145 cd
93[▮ ] 138 vi
94[▮ ] 138 ls
95Total commands: 7062
96Unique commands: 7060
97```