Files
nix-config/scripts/install.sh
T
imbytecat d58c650d59 feat: NixOS 声明式配置(从 Arch + decman 迁移)
- flake.nix: NixOS + home-manager + nixos-wsl 三输入
- hosts/wsl + hosts/bare: WSL 与裸机共享模块,分主机配置
- modules/: base(CLI 工具) + dev(工具链+LSP) + docker + locale + shell
- home/: zsh(oh-my-zsh+插件+别名) + git(delta) + starship + 工具集成
- scripts/install.sh: 一键安装脚本(WSL/裸机通用)
- 原 bun/go 全局包 hack 改为 nixpkgs 声明式管理
2026-04-03 19:05:06 +08:00

26 lines
791 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# NixOS 配置安装脚本
# 在 NixOS-WSL 或裸机 NixOS 中运行
set -euo pipefail
REPO_URL="https://git.furtherverse.com/imbytecat/archlinux-config.git"
CONFIG_DIR="$HOME/.config/nixos-config"
FLAKE_TARGET="${1:-wsl}" # 默认 wsl,裸机传入 bare
echo "📥 获取配置仓库..."
if [[ -d "$CONFIG_DIR/.git" ]]; then
echo "⏩ 仓库已存在,拉取最新..."
git -C "$CONFIG_DIR" pull
else
git clone -b nixos "$REPO_URL" "$CONFIG_DIR"
fi
echo "⚙️ 应用系统配置(目标: $FLAKE_TARGET..."
sudo nixos-rebuild switch --flake "$CONFIG_DIR#$FLAKE_TARGET"
echo ""
echo "🎉 安装完成!请重新登录以使用 zsh。"
echo ""
echo "后续更新:"
echo " cd $CONFIG_DIR && git pull && sudo nixos-rebuild switch --flake .#$FLAKE_TARGET"