个人 Nix Flake,主要用来管理NixOS、home-manager、nix-darwin配置,也包含packages/bundlers等flake输出支持。
- 支持的系统架构:
x86_64-linux、aarch64-linux、aarch64-darwin - nixos配置:
playground(NixOS,impermanence + home-manager + 示例服务) - home-manager配置:
razyang、root、root@playground(均为 x86_64-linux)、yang(aarch64-darwin) - packages:
hello-custom、nixvim、hm-switch等 - formatter:treefmt
- 交叉编译支持:nix build .#pkgsCross.aarch64-multiplatform.hello-custom
flake.nix:目前该文件的作用约等于go.mod,真正的entrypint为part.nix,这么做是为rfc_0193以及rfc_0194做准备modules:参考dendritic模式,每个文件都是一个flake moduleservices/:process-compose-flake服务packages/:自定义包,按包名分目录,自动导入每个目录下的package.nix文件,具有交叉编译支持devshells/:numtide/devshelldevelop环境定义独立,自动导入每个子目录下的devshell.nixbundlers/:应用打包器集合,自动导入每个子目录下的bundler.nix
- 安装 Nix 并启用一些额外的实验特性
nix-command flakes pipe-operators - 克隆仓库:
git clone <repo-url> && cd dotfiles - 预览输出:
nix flake show - NixOS:
nix run .#nixos-switch - nix-darwin:
nix run .#darwin-switch - 独立home-manager:
nix run .#hm-switch - 构建包:
nix build .#hello-custom、nix run .#pkgsCross.aarch64-multiplatform.hello-custom - 进入开发环境:
nix develop .#hello-custom - 代码格式化:
nix fmt