Personal dotfiles managing configuration for NixOS Linux and macOS.
git clone https://github.com/mantas6/dots.git "$HOME/.dots"
cd "$HOME/.dots"
./bin/stwIf stow fails, remove conflicting files (preferably to trash) and run again. Pay close attention to the output to make sure that the links that it creates make sense.
nix build .#nixosConfigurations.iso.config.system.build.isoImageThe ISO image is placed in result/iso/.
Normal setup:
nix run nixpkgs#nixos-anywhere -- \
--flake ".#__host__" \
--generate-hardware-config nixos-generate-config nix/hosts/__host__/_hardware.nix \
--target-host "root@__host__"Encrypted setup:
nix run nixpkgs#nixos-anywhere -- \
--flake ".#__host__" \
--disk-encryption-keys /tmp/secret.key <(pass "hosts/__host__") \
--generate-hardware-config nixos-generate-config nix/hosts/__host__/_hardware.nix \
--target-host "root@__host__"nixos-rebuild switch --flake .#__host__ --target-host __host__ --ask-sudo-passwordRun when need to migrate old version of dotfiles structure
cd "$HOME/.dots"
./bin/stw -D
git pull
./bin/stwsudo nixos-rebuild --install-bootloader switch --flake .trash "$HOME/.local/share/nvim" "$HOME/.local/state/nvim" "$HOME/.cache/nvim"To initialize new environment run:
git clone https://github.com/mantas6/dots.git "$HOME/.dots"
cd "$HOME/.dots"
./bin/rebuild-macos-env brewRestart the shell and run stow:
cd "$HOME/.dots"
./bin/stwRun the script again to continue setup:
rebuild-macos-env initUpdate all packages:
brew bundle upgrade --globalClean up removed packages:
brew bundle cleanup --globalFormat all Nix files:
nix fmt .Format all Lua files:
find . -name '*.lua' -exec stylua {} +Format all shell scripts:
shfmt -w $(shfmt -f .)Run stress test on the CPU:
nix run nixpkgs#stress-ng -- -c0Monitor temperatures:
nix run nixpkgs#s-tuiEdit/create a secret:
agenix -e nix/_lib/secrets/__name__.ageAfter saving update the secrets.nix
agenix --rekeyssh-keyscan __host__On laptops with hardware-battery TLP keeps the battery between 40% and 60% to prolong its life.
Charge to 100% once (the configured thresholds return on reboot or with sudo tlp setcharge):
sudo tlp fullchargeRestore the configured thresholds immediately:
sudo tlp setchargeCheck the current thresholds:
sudo tlp-stat -bCheck that automatic system upgrades run successfully.
Force an automatic system upgrade:
systemctl start nixos-upgradeCheck the upgrade log:
systemctl status nixos-upgrade.serviceOr, to see the full log:
journalctl -u nixos-upgrade.serviceTo see the status of the upgrade timer:
systemctl status nixos-upgrade.timerHosts with containers-chatterbox (currently lm) serve Chatterbox Turbo text-to-speech on port 8004 with an OpenAI-compatible API. The container starts on the first connection and stops after 15 minutes without traffic, so the first request after idle takes a while (tens of seconds, several minutes on the very first run while the model downloads). Use a generous client timeout.
Generate speech with the default female voice:
curl -X POST http://lm:8004/v1/audio/speech \
-H 'Content-Type: application/json' \
-d '{"model":"chatterbox-turbo","input":"Hello from lm. [chuckle]","voice":"Emily.wav","response_format":"mp3"}' \
-o out.mp3Turbo supports tags like [laugh], [chuckle], [sigh] and [cough] in the text. response_format can be wav, mp3 or opus.
List available voices:
curl http://lm:8004/v1/audio/voicesTo clone a voice, put a wav clip longer than 5 seconds into /var/lib/chatterbox/reference_audio/ on the host and pass its file name as voice.
The web UI is at http://lm:8004/.
Check the state of the service and watch it start:
systemctl status chatterbox-proxy.socket docker-chatterbox
journalctl -fu docker-chatterboxStop it manually before the idle timeout:
sudo systemctl stop chatterbox-proxy docker-chatterboxHosts with services-rustypaste (currently l4) run rustypaste at http://pb/ on the LAN. There is no auth; uploads get a random name, are not listed anywhere and are deleted after 24 hours. The page at http://pb/ takes drag and drop.
Upload from a shell; the response body is the URL of the file:
curl -F file=@example.txt http://pbExpire sooner, or serve a file only once:
curl -F file=@example.txt -H 'expire: 1h' http://pb
curl -F oneshot=@example.txt http://pbFiles live in /var/lib/rustypaste on the host, with the expiry timestamp appended to the file name.
Trigger Enter key press on another tmux window:
tmux send-keys -t ":llm" C-mServe the current directory over HTTP with caddy:
nix run nixpkgs#caddy -- file-server --listen :8080 --browse