From fedade9b410d4abcd758909b77fd9cd76341619e Mon Sep 17 00:00:00 2001 From: kappa Date: Wed, 8 Apr 2026 16:33:55 +0900 Subject: [PATCH] =?UTF-8?q?sandbox-tokyo-nixos:=20Gitea=20kaffa/nixos-infr?= =?UTF-8?q?a=20=ED=91=B8=EC=8B=9C=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 로컬 디렉토리 ~/nixos-zlambda → ~/nixos-infra 로 이름 변경 - gitea private repo 생성 후 push - kaffa-macmini, sandbox-tokyo 양쪽에 clone 완료 - 재배포 절차를 "호스트에서 직접 git pull + nixos-rebuild" 흐름으로 갱신 - macOS cross-build 권장하지 않음 안내 - 후속 작업 체크박스 갱신 (Gitea 푸시 완료 표시) --- infra/sandbox-tokyo-nixos.md | 41 +++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/infra/sandbox-tokyo-nixos.md b/infra/sandbox-tokyo-nixos.md index b20da9e..dc67cf3 100644 --- a/infra/sandbox-tokyo-nixos.md +++ b/infra/sandbox-tokyo-nixos.md @@ -48,15 +48,25 @@ GRUB은 BIOS-GPT 방식, sda MBR + BIOS boot partition + /boot inside / fs. ## NixOS Configuration -Mac 로컬에 `~/nixos-zlambda/` 디렉토리(아직 Gitea 미푸시): +**Gitea 저장소**: https://gitea.inouter.com/kaffa/nixos-infra (private) ``` -~/nixos-zlambda/ +nixos-infra/ +├── README.md +├── .gitignore ├── flake.nix # disko + nixpkgs 25.05 +├── flake.lock # 잠긴 input 버전 ├── configuration.nix # 메인 설정 └── hardware-configuration.nix # nixos-anywhere가 자동 생성 ``` +**clone 위치**: +- kaffa-macmini: `~/nixos-infra/` (작성/수정용) +- sandbox-tokyo: `/root/nixos-infra/` (실제 빌드/적용용) +- macbookair: 아직 clone 안 함 (필요 시 `git clone https://gitea.inouter.com/kaffa/nixos-infra.git`) + +향후 두 번째 NixOS 노드 추가 시 `hosts//` 구조로 재편 예정 (README.md 참조). + flake input: - nixpkgs: `github:NixOS/nixpkgs/nixos-25.05` - disko: `github:nix-community/disko` @@ -75,17 +85,31 @@ GRUB 설정: disko의 EF02 파티션이 자동으로 grub.devices를 채워주 ### 재배포/변경 방법 -원격 변경(권장, swap 있어서 안전): +**1. 호스트에서 직접 rebuild (권장, 가장 빠름)** ```fish -cd ~/nixos-zlambda -nixos-rebuild switch --flake .#zlambda --target-host root@sandbox-tokyo --build-host root@sandbox-tokyo +# kaffa-macmini에서 변경 +cd ~/nixos-infra +$EDITOR configuration.nix +git add -A && git commit -m "..." && git push + +# sandbox-tokyo에서 적용 +ssh root@sandbox-tokyo +cd /root/nixos-infra +git pull +nixos-rebuild switch --flake .#zlambda ``` -또는 nixos-anywhere로 처음부터 재설치 (디스크 wipe): +**2. macOS에서 원격 rebuild는 권장하지 않음** + +macOS는 aarch64-darwin이라 x86_64-linux용 nixos-rebuild 래퍼를 native build 못 함. +시도하면 cross-build 단계에서 실패하거나 한참 걸림. 대신 호스트에서 직접 rebuild 권장. +필요 시 kaffa-macmini에 linux-builder VM을 켜면 가능. + +**3. nixos-anywhere로 처음부터 재설치 (디스크 wipe)** ```fish -cd ~/nixos-zlambda +cd ~/nixos-infra nix run github:nix-community/nixos-anywhere -- \ --flake .#zlambda --build-on remote \ root@139.162.71.52 @@ -103,7 +127,8 @@ nix run github:nix-community/nixos-anywhere -- \ ## 알려진 후속 작업 -- [ ] `~/nixos-zlambda/`를 Gitea 리포지토리로 푸시 +- [x] Gitea 리포지토리로 푸시 → `kaffa/nixos-infra` (private). kaffa-macmini와 sandbox-tokyo 양쪽에 clone 완료. macbookair의 ed25519 키도 root authorized_keys에 영구 등록 (configuration.nix). - [ ] [[vault]] SSH CA에 새 호스트키 등록 (vault.md 참조) +- [ ] sandbox-tokyo에 deploy key (SSH) 설정 — 현재 HTTPS clone이라 다음 git pull은 익명/public 가정. 사실은 private repo라 pull 시 인증 필요할 수 있음. SSH deploy key가 깔끔. - [ ] 필요 시 [[netbis]] APISIX/etcd Docker compose 재배포 - [ ] 필요 시 [[searxng]]용 tlsproxy/microsocks 재배포