update nix flake, remote nix-anywhere, update readme

This commit is contained in:
2025-09-03 08:12:35 -04:00
parent f5c4e6c9db
commit 9433abcaf4
3 changed files with 90 additions and 96 deletions

110
README.md
View File

@@ -2,78 +2,54 @@
This repository contains the configuration for multiple machines, as well as my home / IDE config (home-manager).
### NixOS
```bash
sudo nixos-rebuild switch --flake .#lin-va-mbp-personal
# Install NixOS
./bootstrap.sh install --name lin-va-nix-builder
# Remote Image Build (NixOS Builder)
./bootstrap.sh image --name lin-va-rke2 --remote
# Home Manager Install
home-manager switch --flake .#evanreichard@mac-va-mbp-personal
# Update Flake
nix flake update
```
### NixOS Generators
## Manual
```bash
# Install NixOS
sudo nixos-rebuild switch --flake .#lin-va-mbp-personal
# Install NixOS (Remote)
nix run github:nix-community/nixos-anywhere -- --flake .#lin-cloud-kube1 --target-host \<USER\>@\<IP\>
# Build Image
nix build .#vmwareConfigurations.lin-va-rke2
```
### NixOS Anywhere
## Nix Darwin
```bash
nix run github:nix-community/nixos-anywhere -- --flake .#lin-cloud-kube1 --target-host <USER>@<IP>
# Install Nix Without Determinate
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Switch Nix Darwin
sudo nix run nix-darwin#darwin-rebuild -- switch --flake .#mac-va-mbp-personal
sudo darwin-rebuild switch --flake .#mac-va-mbp-personal
```
### Home Manager
## Clean Garbage
NOTE: This will remove previous generations
```bash
home-manager switch --flake .#evanreichard@mac-va-mbp-personal
sudo nix-collect-garbage --delete-old
nix-collect-garbage --delete-old
```
### NixOS Hosts
#### Copy Config
```bash
rsync -av --exclude='.git' . root@HOST:/etc/nixos
```
#### Partition Drives
```bash
# Validate Disk
ls -l /dev/disk/by-id
# Partition Disk
# WARNING: This will destroy all data on the disk(s)
sudo nix \
--experimental-features "nix-command flakes" \
run github:nix-community/disko -- \
--mode disko \
--flake /etc/nixos#HOST_CONFIG
```
#### Install NixOS
```bash
# Install
sudo nixos-install --flake /etc/nixos#HOST_CONFIG
# Reboot
sudo reboot
```
#### Copy Config Back to Host
```bash
rsync -av --exclude='.git' . root@HOST:/etc/nixos
```
#### Rebuild NixOS
```bash
sudo nixos-rebuild switch
```
# Nix Home Manager Configuration - macOS
## Upgrade
## Home Manager
```bash
# Update System Channels
@@ -91,16 +67,7 @@ ln -s /Users/evanreichard/Development/git/personal/nix/home-manager ~/.config/ho
home-manager switch
```
## Clean Garbage
NOTE: This will remove previous generations
```bash
sudo nix-collect-garbage --delete-old
nix-collect-garbage --delete-old
```
## OS Update
### OS Update
`/etc/bashrc` may get overridden. To properly load Nix, prepend the following:
@@ -111,14 +78,3 @@ if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
fi
# End Nix
```
# Nix Darwin
```bash
# Install Nix Without Determinate
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Switch Nix Darwin
sudo nix run nix-darwin#darwin-rebuild -- switch --flake .#mac-va-mbp-personal
sudo darwin-rebuild switch --flake .#mac-va-mbp-personal
```