* feat(nushell): add trash command using the home trash can On a tmpfs root with persistent dirs bind-mounted in, `rm --trash` scatters items into per-mount .Trash-$uid dirs that file managers never show, and gio refuses to trash on those internal mounts. Add a `trash` command implementing the freedesktop trash spec 'failsafe' mode: items are moved to ~/.local/share/Trash with spec-compliant .trashinfo entries, so Thunar can list and restore them. Also preserve ~/.local/share/Trash on idols-ai so the trash survives reboots. * feat(nixos): manage scattered trash dirs with trash-cli retention timer Replace the hand-written nushell trash command with the established trash-cli tooling. On a tmpfs root with persistent dirs bind-mounted in, the trash crate (nushell rm --trash) scatters items into per-mount .Trash-$uid dirs that file managers never show and nothing cleans up. - add trash-cli to system packages: trash-list scans/trash-restore handles every mount point's trash dir - daily systemd timer runs 'trash-empty 30 -f', purging items older than 30 days across the home trash and all mount points - drop the hand-written trash.nu module - note in preservation.nix: do NOT persist ~/.local/share/Trash; a bind-mounted trash dir breaks the trash crate's home-topdir match for files straight under $HOME (it would try /.Trash-$uid, EACCES) * fix(nixos): order trash-empty after preservation.target The scattered .Trash-$uid dirs live inside the preservation bind mounts, which use DefaultDependencies=no and are therefore NOT ordered after local-fs.target. Add preservation.target to After= so trash-empty only runs once all those mounts are up.
❄️ Ryan4Yin's Nix Config ❄️
My configuration is becoming more and more complex, and it will be difficult for beginners to read. If you are new to NixOS and want to know how I use NixOS, I would recommend you to take a look at the ryan4yin/nix-config/releases first, check out to some simpler older versions, such as i3-kickstarter, which will be much easier to understand.
This repository is home to the nix code that builds my systems:
- NixOS Desktops: NixOS with home-manager, niri, agenix, etc.
- macOS Desktops: nix-darwin with home-manager, share the same home-manager configuration with NixOS Desktops.
- NixOS Servers: virtual machines running on Proxmox/KubeVirt, with various services, such as kubernetes, homepage, prometheus, grafana, etc.
See ./hosts for details of each host.
See ./Virtual-Machine.md for details of how to create & manage KubeVirt's Virtual Machine from this flake.
Why NixOS & Flakes?
Nix allows for easy-to-manage, collaborative, reproducible deployments. This means that once something is setup and configured once, it works (almost) forever. If someone else shares their configuration, anyone else can just use it (if you really understand what you're copying/referring now).
As for Flakes, refer to Introduction to Flakes - NixOS & Nix Flakes Book
Want to know NixOS & Flakes in detail? Looking for a beginner-friendly tutorial or best practices? You don't have to go through the pain I've experienced again! Check out my NixOS & Nix Flakes Book - 🛠️ ❤️ An unofficial & opinionated 📖 for beginners!
If you're using macOS, check out ryan4yin/nix-darwin-kickstarter for a quick start.
Components
| NixOS(Wayland) | |
|---|---|
| Window Manager | Niri |
| Terminal Emulator | Zellij + foot/Kitty/Alacritty/Ghostty |
| Status Bar / Notifier / Launcher / lockscreens | noctalia-shell |
| Display Manager | tuigreet |
| Color Scheme | catppuccin-nix |
| network management tool | NetworkManager |
| Input method framework | Fcitx5 + rime + 小鹤音形 flypy |
| System resource monitor | Btop |
| File Manager | Yazi + thunar |
| Shell | Nushell + Starship |
| Media Player | mpv |
| Editors / IDE | Helix (primary), Neovim (backup) — configuration & usage |
| Fonts | Nerd fonts |
| Image Viewer | imv |
| Screenshot Software | Niri's builtin function |
| Screen Recording | OBS |
| Filesystem & Encryption | tmpfs as /, Btrfs subvolumes on a LUKS encrypted partition for persistent, unlock via passphrase |
| Secure Boot | lanzaboote |
Wallpapers: https://github.com/ryan4yin/wallpapers
Screenshots
Editors / IDE
- Terminal editors: ./home/base/core/editors/ — Helix / Neovim,
$EDITOR, docs. - VS Code (GUI, Home Manager on NixOS): ./home/linux/gui/base/editors.nix.
- LLM coding agents: ./agents — rules, installers, CLI snippets; see ./agents/README.md.
Secrets Management
See ./secrets for details.
How to Deploy this Flake?
🔴 IMPORTANT: You should NOT deploy this flake directly on your machine ❗ It will not succeed. This flake contains my hardware configuration(such as hardware-configuration.nix, Nvidia Support, etc.) which is not suitable for your hardware, and requires my private secrets repository ryan4yin/nix-secrets to deploy. You may use this repo as a reference to build your own configuration.
For NixOS:
To deploy this flake from NixOS's official ISO image (purest installation method), please refer to ./nixos-installer/
# deploy one of the configuration based on the hostname
sudo nixos-rebuild switch --flake .#ai-niri
# Deploy the nixosConfiguration matching the hostname immediately
just local
# Set it as the next boot configuration without switching immediately
just local boot
# Deploy with detailed output; use `boot debug` to combine both options
just local switch debug
# Deploy the niri nixosConfiguration by hostname match
just niri
# The niri recipe accepts the same mode and verbosity arguments
just niri boot
just niri switch debug
just niri boot debug
For macOS:
# If you are deploying for the first time,
# 1. install nix & homebrew manually.
# 2. prepare the deployment environment with essential packages available
nix-shell -p just nushell
# 3. comment home-manager's code in lib/macosSystem.nix to speed up the first deployment.
# 4. comment out the proxy settings in scripts/darwin_set_proxy.py if the proxy is not ready yet.
# Deploy the darwinConfiguration by hostname match
just local
# Deploy with details (macOS has no switch/boot mode argument)
just local debug
What y'all will need when Nix drives you to drink. (copy from hlissner's dotfiles, it really matches my feelings when I first started using NixOS...)
References
Other dotfiles that inspired me:
- Nix Flakes
- NixOS-CN/NixOS-CN-telegram
- notusknot/dotfiles-nix
- xddxdd/nixos-config
- bobbbay/dotfiles
- gytis-ivaskevicius/nixfiles
- davidtwco/veritas
- gvolpe/nix-config
- Ruixi-rebirth/flakes
- fufexan/dotfiles: gtk theme, xdg, git, media, etc.
- nix-community/srvos: a collection of opinionated and sharable NixOS configurations for servers
- Modularized NixOS Configuration
- Neovim/AstroNvim
- maxbrunet/dotfiles: astronvim with nix flakes.
- Misc



