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
25```nix
26{ config, pkgs, ... }:
27
28{
29 # ... configuration options
30
31 age.secrets = {
32 atuin-session = {
33 file = ../secrets/atuin-session.age;
34 mode = "0444";
35 };
36 atuin-key = {
37 file = ../secrets/atuin-key.age;
38 mode = "0444";
39 };
40 };
41
42 # ... more configuration options
43}
44```
45
46and then the home-manager bit
47
48> shell.nix in home manager
49
50```nix
51{ config, pkgs, ... }:
52
53{
54 # ... some home-manager modules and configs
55
56 programs.atuin = {
57 enable = true;
58 settings = {
59 auto_sync = true;
60 sync_frequency = "5m";
61 sync_address = "https://api.atuin.sh";
62 search_mode = "fuzzy";
63 session_path = config.age.secrets."atuin-session".path;
64 key_path = config.age.secrets."atuin-key".path;
65 };
66 };
67
68 age.secrets = {
69 atuin-session = {
70 file = ../../secrets/atuin-session.age;
71 };
72 atuin-key = {
73 file = ../../secrets/atuin-key.age;
74 };
75 };
76
77 # ... even more home-manager configurations 😅
78}
79```
80
81Now 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.
82
83Anyways now i'm enjoying my stats and it's on to the next project (proly [serif.blue](https://tangled.org/@dunkirk.sh/serif) 👀)
84
85```
86> atuin stats
87[▮▮▮▮▮▮▮▮▮▮] 1209 gc
88[▮▮▮▮ ] 495 curl
89[▮▮ ] 348 bun
90[▮▮ ] 329 cat
91[▮ ] 222 z
92[▮ ] 200 g
93[▮ ] 162 nix-shell
94[▮ ] 145 cd
95[▮ ] 138 vi
96[▮ ] 138 ls
97Total commands: 7062
98Unique commands: 7060
99```