README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈
嘿, 你。你终于醒了。你之前是在尝试以声明式方式配置你的操作系统,对吧?你一头撞进了那个 NixOS 的埋伏,和我们一样,还有那边的那些 dotfiles。
好消息,旅行者! 这些 dotfiles 现在同时支持 NixOS 和 macOS。一份配置统御万物,在黑暗中将它们束缚。
# Quick taste of what you're in for:
nix run nix-darwin -- switch --flake ~/.config/dotfiles # macOS
nixos-rebuild switch --flake .#hostname # NixOS
| Shell: | zsh + 一堆 Nix 魔法 |
| DM: | lightdm + lightdm-mini-greeter |
| WM: | bspwm + polybar (Linux) / Aerospace (macOS) |
| Editor: | Doom Emacs (以及 Emacs 打盹时的 nvim) |
| Terminal: | st (Linux) / Ghostty (macOS) |
| Launcher: | rofi (Linux) / Raycast (macOS) |
| Browser: | firefox / Zen Browser / Orion (我收集浏览器) |
| GTK Theme: | Ant Dracula |
快速入门
NixOS?我曾经也像你一样是个冒险者……
- Acquire NixOS 24.11 (or close enough).
- Boot into the installer.
- Do your partitions and mount your root to
/mnt(or don't, I'm not your supervisor) git clone https://github.com/emiller88/dotfiles /etc/nixos- Install NixOS:
nixos-install --root /mnt --flake /etc/nixos#XYZ, whereXYZis your hostname. Use#genericfor a simple, universal config. - OPTIONAL: Create a sub-directory in
hosts/for your device. See host/kuro as an example. - Reboot!
macOS?让我猜猜,有人偷走了你的甜甜圈。
- Install Nix using the Determinate Systems installer (it's like the official installer, but actually works):
Why this installer? It handles macOS quirks, enables flakes by default, and won't leave you troubleshooting for hours.curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install git clone https://github.com/emiller88/dotfiles ~/.config/dotfilescd ~/.config/dotfiles./bin/hey re(or ifheyisn't in your PATH yet:nix run .#darwinConfigurations.HOSTNAME.system.build.darwin-rebuild -- switch --flake .)- Use
MacTraitor-ProorSeqeratopfor HOSTNAME, or checkflake.nixfor available configs
- Use
- Grab a coffee while Nix downloads the internet
sudo ./result/sw/bin/darwin-rebuild --flake .#HOSTNAME switchwhen prompted
管理
我说,bin/hey。怎么回事?
| 命令 | 描述 |
|---|---|
hey rebuild | 重建此 flake(快捷键:hey re) |
hey upgrade | 更新 flake 锁文件并切换至该文件(快捷键:hey up) |
hey rollback | 回滚到上一个系统生成版本 |
hey gc | 运行 nix-collect-garbage -d。使用 sudo 清理系统配置文件 |
hey push REMOTE | 通过 ssh 将这些 dotfiles 部署到 REMOTE |
hey check | 为此 flake 运行测试和检查 |
hey show | 显示此仓库的 flake 输出 |
hey skillkit-sync | 重新安装/重新修补 @crafter/skillkit 以支持 Amp + Pi |
在 macOS 上,hey re 还会通过 Home Manager 为任何启用 modules.shell.skillkit 的主机重新应用 Skillkit 补丁。如果您手动重新安装
@crafter/skillkit,请运行 hey skillkit-sync 以恢复该补丁。
常见问题
-
How do I change the default username?
- Set
USERthe first time you runnixos-install:USER=myusername nixos-install --root /mnt --flake #XYZ - Or change
"emiller"in modules/options.nix (was"hlissner"in the before times). - For macOS: just make sure your username matches what's in the flake
- Set
-
我该如何“设置分区”?
我的主主机 有一个 README 你可以用作参考。
我设置了一个 EFI+GPT 系统,并使用 parted 和 zfs 划分了分区。
macOS 用户:您可以跳过此部分并为此感到得意。
-
为什么我的构建因 homebrew 错误而失败?
这只是 homebrew 的常态。构建已经成功,你只需要使用 sudo 运行激活。查看
hey re末尾的消息。 -
为什么有 2 个 flakes?
如果我把所有答案都放在一个方便的地方,那就不是 NixOS 的体验了。但基本上:现在一切都是 flake,抵抗是徒劳的。
作为 flake 使用
将 dotfiles 添加到您的 flake.nix:
{
inputs.dotfiles.url = "https://flakehub.com/f/Emiller88/dotfiles/*.tar.gz";
outputs = { self, dotfiles }: {
# Use in your outputs
};
}