restructured and optimized content
This commit is contained in:
25
README.md
25
README.md
@@ -42,11 +42,15 @@
|
||||
3. 挂载
|
||||
|
||||
```bash
|
||||
mkdir -p /mnt/{boot,nix}
|
||||
mount /dev/sda2 /mnt/nix
|
||||
mkdir -p /mnt/boot
|
||||
mount /dev/sda1 /mnt/boot
|
||||
```
|
||||
|
||||
3.1 不变系统
|
||||
|
||||
如何希望使用不变原子系统, 在 profile 中引入 `modules/nixos/sysatomic.nix` 模块.
|
||||
|
||||
4. 生成一个基本的配置
|
||||
|
||||
```bash
|
||||
@@ -56,10 +60,8 @@
|
||||
5. 克隆仓库到本地
|
||||
|
||||
```bash
|
||||
nix-shell -p git
|
||||
git clone https://github.com/synebula/.nix.git /mnt/.nix
|
||||
cd /mnt/.nix/
|
||||
nix develop --extra-experimental-features "nix-command flakes"
|
||||
git clone https://github.com/synebula/.nix.git /mnt/nix/.nix
|
||||
cd /mnt/nix/.nix
|
||||
```
|
||||
|
||||
6. 将 /mnt/etc/nixos 中的 `hardware-configuration.nix` 拷贝到 `/mnt/.nix/profiles/<profile>/hardware-configuration.nix`, 其中`<profile>`指需要的 profile。
|
||||
@@ -67,19 +69,20 @@ nix develop --extra-experimental-features "nix-command flakes"
|
||||
```bash
|
||||
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/.nix/profiles/<profile>/hardware-configuration.nix
|
||||
```
|
||||
|
||||
7. 用户名修改: 编辑 `/mnt/.nix/flake.nix` 修改 **username** 变量。
|
||||
|
||||
8. 使用 `mkpasswd {PASSWORD} -m sha-512` 命令生成的密码哈希串替换掉 `/mnt/.nix/modules/nixos/user-group.nix` 中的 `users.users.<name>.hashedPassword` 值替换掉。
|
||||
|
||||
|
||||
9. 安装
|
||||
|
||||
```bash
|
||||
nixos-install --option substituters "https://mirrors.ustc.edu.cn/nix-channels/store https://cache.nixos.org" --no-root-passwd --flake .#<profile>
|
||||
./nixos-install.sh <profile>
|
||||
|
||||
# 或者
|
||||
|
||||
./nixos-install <profile>
|
||||
nixos-install --option substituters "https://mirrors.ustc.edu.cn/nix-channels/store https://cache.nixos.org" --no-root-passwd --flake .#<profile>
|
||||
|
||||
```
|
||||
|
||||
10. 重启
|
||||
@@ -90,6 +93,6 @@ reboot
|
||||
|
||||
### 日常更新系统脚本
|
||||
|
||||
``` bash
|
||||
./nixos-switch
|
||||
```
|
||||
```bash
|
||||
./nixos-switch.sh
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user