# nixConfig **Repository Path**: tonygp/nix-config ## Basic Information - **Project Name**: nixConfig - **Description**: nixos的配置 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-17 - **Last Updated**: 2026-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # NixOS 配置 这是一个完整的 NixOS 配置,包含 Btrfs 文件系统、Wayland 桌面环境、中文支持等完整配置。 ## 配置特性 ### 系统配置 - **文件系统**: Btrfs with 子卷分离(@, @home, @nix, @log) - **桌面环境**: Niri (Wayland compositor) + SDDM 显示管理器 - **显卡驱动**: NVIDIA (支持 RTX 50 系列) - **输入法**: fcitx5 + rime (支持 Wayland) - **Shell**: 系统默认 zsh,用户使用 fish - **容器**: Podman (兼容 Docker 命令) ### 用户配置(Home Manager) - **终端工具**: eza, bat, ripgrep, fd, zoxide - **Shell 增强**: starship, fish-prompt - **办公软件**: WPS Office + 中文字体 - **其他工具**: Zathura (PDF), yt-dlp ### 网络与连接 - WiFi 支持(NetworkManager 管理) - 蓝牙支持 - SSH 服务 - 国内镜像源加速(中科大、清华) ## 目录结构 ``` nix-config/ ├── init/ │ ├── configuration.nix # 系统级配置 │ ├── andykim.nix # 用户级配置(Home Manager) │ ├── INSTALL.md # 详细安装教程 │ └── hardware-configuration.nix # 硬件配置(自动生成) └── README.md # 本文件 ``` ## 快速开始 ### 1. 安装前准备 下载 NixOS ISO: - 官方: https://channels.nixos.org/nixos-25.11/latest-nixos-plasma6-x86_64-linux.iso - 清华镜像: https://mirrors.tuna.tsinghua.edu.cn/nixos-images/ ### 2. 安装系统 详细安装步骤请查看 [INSTALL.md](init/INSTALL.md) 基本流程: 1. 使用 U 盘启动 NixOS 安装环境 2. 使用 cfdisk 分区(EFI + Btrfs 根分区) 3. 创建 Btrfs 子卷 4. 配置并安装系统 5. 重启进入新系统 ### 3. 配置修改 在安装前需要修改配置文件中的以下内容: - **用户名**: [configuration.nix:121](init/configuration.nix#L121) 中的 `andykim` - **初始密码**: [configuration.nix:124](init/configuration.nix#L124) 中的 `12345678` - **主机名**: [configuration.nix:80](init/configuration.nix#L80) 中的 `andykim-desktop` ## 使用说明 ### 更新系统 ```bash # 更新 channel 并升级系统 sudo nix-channel --update sudo nixos-rebuild switch --upgrade # 仅更新配置 sudo nixos-rebuild switch ``` ### 用户配置更新 ```bash # 使用 Home Manager 更新用户配置 home-manager switch ``` ### 添加软件 **系统级软件**(所有用户可用): 编辑 `configuration.nix` 的 `environment.systemPackages` 部分 **用户级软件**(仅当前用户): 编辑 `andykim.nix` 的 `home.packages` 部分 ### Btrfs 快照管理 ```bash # 创建根目录快照 sudo btrfs subvolume snapshot -r / /@root-$(date +%Y%m%d-%H%M%S) # 创建 home 快照 sudo btrfs subvolume snapshot -r /home /@home-$(date +%Y%m%d-%H%M%S) # 查看所有子卷 sudo btrfs subvolume list / ``` ### 系统回滚 ```bash # 回滚到上一个系统配置 sudo nixos-rebuild switch --rollback # 查看历史版本 sudo nix-env --list-generations --profile /nix/var/nix/profiles/system ``` ## Btrfs 子卷结构 | 子卷 | 挂载点 | 用途 | |------|--------|------| | @ | / | 系统根目录 | | @home | /home | 用户数据 | | @nix | /nix | Nix 软件包存储 | | @log | /var/log | 日志子卷 | **优点**: - 系统和用户数据分离 - 日志独立存储,避免占满磁盘空间 - 快照体积更小(不包含用户数据和 nix 缓存) - 方便快速回滚 ## 硬件要求 - UEFI 支持 - 至少 20GB 磁盘空间 - 建议 8GB 以上内存 - NVIDIA 显卡(配置已优化 NVIDIA 驱动) ## 常见问题 详见 [INSTALL.md - 常见问题](init/INSTALL.md#常见问题) ### 中文显示问题 确保已安装中文字体(配置中已包含 wqy-zenhei, wqy-microhei, noto-fonts-cjk) ### WiFi 连接 ```bash # 图形界面 nmtui # 命令行 nmcli device wifi list nmcli device wifi connect "SSID" password "密码" ``` ### 中文输入法 确保环境变量正确设置: ```bash echo $GTK_IM_MODULE # 应该显示 fcitx echo $QT_IM_MODULE # 应该显示 fcitx ``` ## 参考资源 - [NixOS 手册](https://nixos.org/manual/nixos/stable/) - [NixOS Options 搜索](https://search.nixos.org/options) - [Nixpkgs 包搜索](https://search.nixos.org/packages) - [Home Manager 手册](https://nix-community.github.io/home-manager/) ## 许可证 本配置文件可自由使用和修改。 ## 贡献 欢迎提交 Issue 和 Pull Request!