This is my setup for NixOS.
- reproducible
- NixOS with flakes to lock versions
- ephemeral root to stay conscious about unreproduced state
- ergonomics
- keyboard-first favoring vim-like keybinds
- intuitiveness
- scrollable tiling
(credit: wallpaper by Alena Aenami.)
JIT-installed neofetch
thefuck plugin for zsh (hit double Esc) filled the JIT-install command for the missing app neofetch.
the expanded notification bar SwayNotificationCenter is shown with a notification about a completed rebuild. this menu can be opened using `Super+`` or by right-clicking the 'Windows' button.
file managers
yazi is a terminal-based file manager with vim-like keybindings.
thunar is available as a graphical alternative.
terminal-based IDE
running ide in the WezTerm terminal opens a terminal-based IDE at that directory, consisting of:
- Git TUI
lazygit, offering a terminal-based way to work with Git repositories, including vim keybindings. helix, featuring language servers for nix (thrunixd) and others- a shell, using Zsh and decorated using
powerline-go
As a back-up, the graphical VSCodium is provided (with some plugins).
application menu
Application menu anyrun can be opened using Super+Space or by left-clicking the 'Windows' button.
JIT application menu
A menu to JIT-install and run applications can be opened using Super+Shift+Space.
emoji picker
pressing the Microsoft keyboard's emoji key](https://support.microsoft.com/en-us/topic/use-microsoft-ergonomic-keyboard-c917dad0-3797-d97b-efb3-fbe27ac9703c#ID0EDFBBDDD) (Super-Ctrl-Alt-Shift-Space) triggers an emoji picker using fuzzy picker fzf.
file picker
pressing CTRL-T in the shell opens fzf's file picker, copying the selected file or directory path to the clipboard.
This configuration was made with the following devices in mind:
| Name | Use | Model | Config |
|---|---|---|---|
hammer |
home laptop | Lenovo IdeaPad Slim 5 16ABR8 | nixosConfigurations |
orca |
work laptop | Dell XPS 13 9340 | homeConfigurations |
- update
./hosts/<PROFILE>/hardware-configuration.nix - on an existing system, disable impermanence to prevent existing files not opted into persistence from being wiped on boot
- replace currently hardcoded values
- get a user password by either:
- setting one in
./hosts/<PROFILE>/configuration.nix - decoding secrets by adding the
agekeys file to/etc/nixos/keys.txt
- setting one in
clean install from NixOS USB
cd Downloads
git clone https://codeberg.org/kiara/cfg.git
cd cfg
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko -f .#hammer
dest=/mnt/persist/home/kiara/.config/sops/age/
sudo mkdir -p $dest
sudo cp -r ./. $dest
sudo cp ~/Downloads/keys.txt $dest # import/create
sudo nixos-install --no-root-passwd --flake .#default --no-root-passwd
sudo nixos-enter --root /mnt
cp /etc/{machine-id,group,passwd,shadow} /persist/etcinstall from existing NixOS system
$ nix --experimental-features "nix-command flakes" run nixpkgs#just -- switch$ just -l
Available recipes:
age # Check when inputs were last updated
boot # Build a new configuration
clean # Remove all generations older than 7 days
decode # Decode secrets
default # default action: list actions
dry # Dry-build a new configuration
encode # Encode secrets
ephemeral dir="$HOME" # Show what has yet to be persisted in a folder. Usage: just ephemeral $HOME | $PAGER
fmt # Format code
gc # Garbage collect all unused nix store entries
home # Rebuild the home config
patch-desktop-xwayland # Patch persisted wine/steam desktop entries to run xwayland
repl # Open a Nix REPL - run manually to load flake: `:lf .`
switch # Rebuild the system
test # Run tests
up # Update all inputs
upp input # Update specific input. Usage: just upp nixpkgs
... or if just isn't available yet:
nix run nixpkgs#just -- -lto ensure you can persist useful state on an ephemeral system, you can find say:
- newly created (5 mins) files:
find ~ -cmin -5 - files now on root:
tree -x / - diffs from last backup:
rsync --dry-run
- secrets: sops
- formatter: treefmt
- commands: just
- CI: garnix
- cache:
./cachix/ - environment loader: direnv
- declarative partitioning: disko
- ephemeral root: impermanence
- the
flake.locked nixpkgs is used for:- nix commands
- 'command not found' errors
nix flake showis fixed using Flake Schemas$SHELLis retained innix shell
| Component | Software |
|---|---|
| Nix interpreter | Lix |
| Nix shell | Lorri |
| DM | TUIgreet |
| Compositor | Niri1 |
| Bar | Waybar |
| Notifications | Swaynotificationcenter |
| Menu | Anyrun |
| Web browser | Firefox |
| File browser | Yazi |
| Terminal | Wezterm |
| Text editor | VSCodium |
| Editor (shell) | Helix |
| Shell | Zsh |
| Fuzzy finder | Fzf |
| Pager | Nvimpager |
| Text-to-speech | Piper thru LocalAI |
- theming module: Stylix
- GUI theme: Catppuccin-Mocha-Maroon
- shell theme: base16-classic-dark
- icons: Papirus-Dark
- fonts:
- regular: DejaVu Sans
- monospace MartianMono
- emoji: Twemoji
| command | drop-in | improvements |
|---|---|---|
cd |
n/a | (can skip it in Zsh) |
cd |
z |
remembers visited locations |
cd |
cd (enhancd) |
interactive directory picker using cd, cd . or cd .. |
ls |
eza (aliased to ls) |
friendlier output and interface |
cat |
bat |
syntax highlighting |
less |
less (lesspipe) |
syntax highlighting |
find |
fd |
faster, friendlier interface, respects .gitignore |
grep |
rg |
friendlier interface |
make |
just |
show comments, friendlier file format |
ssh |
xxh |
use your favorite shell |
Used keyboard layouts, with Caps Lock remapped to Esc:
- workman-programmer, with application keymaps modified to keep arrow actions
h/j/k/l(+ actions 'y'/'n') in their ergonomic qwerty positions (at the cost of moving actionse/oto keysh/l) en-us(qwerty)
Application keybinds, tweaked to layout by setting config.keyboard.active:
niri: see./home-manager/kiara/niri.nix(TODO)swaynotificationcenterfirefox(vimium-c)yazi(custom)wezterm(overrides:./home-manager/kiara/wezterm.nix)vscodium(overrides:./home-manager/kiara/vscode.nix)helix(overrides:./home-manager/kiara/features/text/helix.nix)neovimzshgumzathura
| module | left-click | right-click | scroll |
|---|---|---|---|
| start button | open anyrun application launcher |
toggle swaync notifications |
- |
| media player | toggle play/pause | skip ahead | previous/next |
| clock | - | toggle month/year in calendar pop-up | previous/next in calendar pop-up |
| bluetooth | bluetuith |
bluetuith |
- |
| volume | toggle mute | Pulse Audio Volume Control | change volume |
| memory | manage processes with Bottom | - | - |
| CPU | manage processes with Bottom | - | - |
| battery | run battery viewer powersupply |
- | - |
| storage | garbage-collect nix | show big files/folders using dust |
- |
| network | manage network by networkmanager_dmenu |
manage network by nmtui |
- |
| systray | (application-specific) | open application context menu | - |
| what | where |
|---|---|
| system configuration | ./hosts/ |
| home-manager configuration | ./home-manager/ |
| binaries and command wrappers | ./home-manager/kiara/commands.nix |
| reusable modules | ./modules/ |
| custom functions | ./lib/ |
| custom packages | ./pkgs/*.nix (from flake inputs: ./pkgs/default.nix) |
| overlays | ./overlays/*.nix (from flake inputs: ./flake.nix) |
| LSP (vscodium / coc.nvim) | ./home-manager/kiara/features/development/ |
| shell scripts | ./home-manager/kiara/scripts/*.sh |
| dotfiles | ./home-manager/kiara/dotfiles/ + ./home-manager/kiara/dotfiles.nix |
| custom desktop entries | ./home-manager/kiara/desktop.nix |
| MIME types | ./home-manager/kiara/mime.nix |
| file templates | ./home-manager/kiara/dotfiles/Templates/ |
| keybinds | ./home-manager/kiara/niri.nix |
| persisted state | ./hosts/hammer/persistence.nix |
Footnotes
-
While Niri uses Wayland, X11 applications can be emulated thru
xwayland-run. ↩