调整项目结构和readme
This commit is contained in:
65
README.md
65
README.md
@@ -10,27 +10,26 @@
|
||||
│ ├── desktop.nix # 桌面环境配置
|
||||
│ └── server.nix # 服务器配置
|
||||
├── libs # 自定义库函数
|
||||
│ ├── default.nix # 导出所有库函数
|
||||
│ └── mkNixosSystem.nix # 创建nixosSystem的通用函数
|
||||
├── modules # 通用模块,不同机器可以根据的需要引入
|
||||
│ ├── home # home manager 通用模块
|
||||
│ │ └── - # home manager 通用模块
|
||||
│ └── nixos # nixos 通用模块
|
||||
│ └── - # nixos 通用模块
|
||||
├── overlays # 安装包的修改配置
|
||||
│ └── - # 安装包的修改配置
|
||||
│ └── default.nix # 覆盖配置入口
|
||||
├── pkgs # 自定义软件包
|
||||
│ └── -
|
||||
├── profiles # 不同机器的配置文件, 放置只有特定主机可以使用的配置
|
||||
│ ├── apollo # 主服务器配置
|
||||
│ │ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
||||
│ │ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── home # apollo的home-manager配置
|
||||
│ │ └── nixos # apollo的NixOS配置
|
||||
│ │ └── network.nix # 网络配置
|
||||
│ ├── gaea # 主用机配置
|
||||
│ │ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
||||
│ │ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── home # gaea的home-manager配置
|
||||
│ │ └── nixos # gaea的NixOS配置
|
||||
│ └── luna # 虚拟机配置
|
||||
│ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
||||
│ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ ├── hardware-configuration.nix # 硬件配置
|
||||
│ └── network.nix # 网络配置
|
||||
├── flake.lock # flake 锁定文件
|
||||
├── flake.nix # nix flake 入口
|
||||
├── nixos-install.sh # nixos 全新安装脚本
|
||||
@@ -170,3 +169,45 @@ nixos-switch
|
||||
2. **profiles/[hostname]/default.nix** - 这是配置的入口文件,负责选择使用的 nixpkgs 版本并调用 libs.mkNixosSystem 函数。
|
||||
|
||||
3. **profiles/[hostname]/configuration.nix** - 包含实际的配置内容,如系统模块、服务、用户设置等。
|
||||
|
||||
## 垃圾清理
|
||||
|
||||
home-manager profiles 文件夹
|
||||
|
||||
```bash
|
||||
~/.local/state/nix/profiles/
|
||||
```
|
||||
|
||||
1. 列出历史版本
|
||||
|
||||
```bash
|
||||
# 最新api
|
||||
nix profile history --profile /nix/var/nix/profiles/system
|
||||
nix profile history --profile ~/.local/state/nix/profiles/home-manager
|
||||
|
||||
# nixos系统api
|
||||
nixos-rebuild list-generations
|
||||
|
||||
# 旧版api
|
||||
nix-env --list-generations -p /nix/var/nix/profiles/system
|
||||
```
|
||||
|
||||
2. 查看根依赖
|
||||
|
||||
```bash
|
||||
nix-store --query --roots /nix/store/ijr7hck016n92ds7zh9syv51qv4cl8zg-wechat-uos-4.0.0.23
|
||||
```
|
||||
|
||||
3. 删除历史generations
|
||||
|
||||
```bash
|
||||
nix profile wipe-history --profile ~/.local/state/nix/profiles/home-manager # 清除所有非当前
|
||||
nix profile wipe-history --older-than 1d --profile /nix/var/nix/profiles/system # 保留最近7天
|
||||
nix profile wipe-history --older-than 7d --profile ~/.local/state/nix/profiles/home-manager # home-manager单独清除
|
||||
```
|
||||
4. 删除旧版本
|
||||
|
||||
```bash
|
||||
nix-collect-garbage --delete-older-than 30d
|
||||
nix-collect-garbage -d # --delete-old 清除所有未使用的
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user