Initial commit: NexusOS project + desktop theme baseline
Captures the known-good state after theme consolidation and consistency reconciliation: - NexusOS GTK/xfwm4/icon theme assets (assets/themes, management/Mint-Y-Nexus) - Tightened right-click menus, visible separators, no menu icons - assets/themes/install-theme.sh: idempotent restore of all wiring (symlinks, xfconf xsettings+xfwm4, GTK 3/4 settings.ini) - .gitignore excludes venv/ollama/models/runtime/db Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
NEXUS_ROOT="$HOME/nexus-core"
|
||||
|
||||
rsync -avz --delete \
|
||||
--exclude='Promethean/' \
|
||||
--exclude='models/blobs/' \
|
||||
--exclude='ollama/' \
|
||||
--exclude='management/Mint-Y-Nexus/' \
|
||||
--exclude='interface/web/node_modules/' \
|
||||
--exclude='interface/web/dist/' \
|
||||
--exclude='runtime/' \
|
||||
--exclude='__pycache__/' \
|
||||
--exclude='*.pyc' \
|
||||
-e ssh \
|
||||
"$NEXUS_ROOT/" "router:/tmp/mnt/Wingdrive2/nexus-backup/"
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
lftp sftp://router:2022 << 'LFTP'
|
||||
set sftp:connect-program "ssh -a -x -p 2022"
|
||||
set cmd:interactive yes
|
||||
mirror --reverse --delete --verbose --dereference --exclude "^Promethean/" --exclude "^models/blobs/" --exclude "^ollama/" --exclude "^interface/web/node_modules/" --exclude "^interface/web/dist/" --exclude "^runtime/logs/" --exclude "runtime/backend\.log$" --exclude "runtime/frontend\.log$" --exclude "__pycache__" --exclude "\.pyc$" /home/jon/nexus-core /Wingdrive2/nexus-backup
|
||||
quit
|
||||
LFTP
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import re, subprocess, sys
|
||||
from pathlib import Path
|
||||
|
||||
NEXUS_ROOT = Path.home() / "nexus-core"
|
||||
NVIDIA_REQS = NEXUS_ROOT / "nvidia_requirements.txt"
|
||||
|
||||
CUDA_TO_WHEEL = [
|
||||
((12, 8), "cu128"),
|
||||
((12, 6), "cu126"),
|
||||
((12, 4), "cu124"),
|
||||
((12, 1), "cu121"),
|
||||
((11, 8), "cu118"),
|
||||
]
|
||||
|
||||
def detect_cuda():
|
||||
try:
|
||||
out = subprocess.run(["nvidia-smi"], capture_output=True, text=True, timeout=10).stdout
|
||||
m = re.search(r"CUDA Version:\s*(\d+)\.(\d+)", out)
|
||||
if m:
|
||||
return int(m.group(1)), int(m.group(2))
|
||||
except (FileNotFoundError, subprocess.TimeoutExpired):
|
||||
pass
|
||||
return None, None
|
||||
|
||||
def wheel_suffix(major, minor):
|
||||
for (req_major, req_minor), suffix in CUDA_TO_WHEEL:
|
||||
if (major, minor) >= (req_major, req_minor):
|
||||
return suffix
|
||||
return "cu118"
|
||||
|
||||
def main():
|
||||
print("Detecting NVIDIA GPU...")
|
||||
major, minor = detect_cuda()
|
||||
|
||||
if major is None:
|
||||
print("Error: nvidia-smi not found or CUDA version unreadable.")
|
||||
print("Ensure NVIDIA drivers are installed and nvidia-smi is on your PATH.")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"CUDA {major}.{minor} detected.")
|
||||
suffix = wheel_suffix(major, minor)
|
||||
print(f"PyTorch wheel: {suffix}")
|
||||
|
||||
NVIDIA_REQS.write_text(f"""\
|
||||
# --- Force NVIDIA/CUDA Priority ---
|
||||
--index-url https://download.pytorch.org/whl/{suffix}
|
||||
--extra-index-url https://pypi.org/simple
|
||||
|
||||
-r requirements-base.txt
|
||||
|
||||
# GPU Compute Stack
|
||||
torch
|
||||
torchaudio
|
||||
torchvision
|
||||
""")
|
||||
|
||||
print(f"\nWritten: {NVIDIA_REQS}")
|
||||
print("Run 'ncp backup' to push it to the router.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+185
@@ -0,0 +1,185 @@
|
||||
#!/bin/bash
|
||||
|
||||
NEXUS_ROOT="$HOME/nexus-core"
|
||||
ROUTER_BACKUP="router:/tmp/mnt/Wingdrive2/nexus-backup/"
|
||||
|
||||
# ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
is_wsl() {
|
||||
grep -qi microsoft /proc/version 2>/dev/null
|
||||
}
|
||||
|
||||
detect_requirements() {
|
||||
if command -v nvidia-smi &>/dev/null && nvidia-smi &>/dev/null 2>&1; then
|
||||
echo "nvidia_requirements.txt"
|
||||
elif lspci 2>/dev/null | grep -qi nvidia; then
|
||||
echo "nvidia_requirements.txt"
|
||||
else
|
||||
echo "amd_requirements.txt"
|
||||
fi
|
||||
}
|
||||
|
||||
get_windows_user() {
|
||||
powershell.exe -command '$env:USERNAME' 2>/dev/null | tr -d '\r\n'
|
||||
}
|
||||
|
||||
setup_windows() {
|
||||
local win_user distro icon_src icon_win_dir icon_win_path wt_settings
|
||||
|
||||
win_user=$(get_windows_user)
|
||||
distro="${WSL_DISTRO_NAME:-$(uname -n)}"
|
||||
|
||||
if [ -z "$win_user" ] || [ ! -d "/mnt/c/Users/$win_user" ]; then
|
||||
echo "Could not locate Windows user directory — skipping Windows setup."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Copy icon to Windows filesystem
|
||||
icon_src="$NEXUS_ROOT/assets/nexus-terminal.png"
|
||||
icon_win_dir="/mnt/c/Users/$win_user/AppData/Local/Nexus"
|
||||
mkdir -p "$icon_win_dir"
|
||||
cp "$icon_src" "$icon_win_dir/nexus-terminal.png"
|
||||
icon_win_path="C:\\Users\\$win_user\\AppData\\Local\\Nexus\\nexus-terminal.png"
|
||||
|
||||
# Create combined init file so WT session has ncp, nvm, and Promethean prompt
|
||||
cat > "$HOME/.promethean_init" << 'EOF'
|
||||
[[ -f ~/.bashrc ]] && source ~/.bashrc
|
||||
[[ -f ~/.promethean_bashrc ]] && source ~/.promethean_bashrc
|
||||
EOF
|
||||
|
||||
# Patch Windows Terminal settings.json
|
||||
python3 - "$win_user" "$distro" "$icon_win_path" << 'PYEOF'
|
||||
import json, uuid, sys
|
||||
from pathlib import Path
|
||||
|
||||
win_user, distro, icon_path = sys.argv[1], sys.argv[2], sys.argv[3]
|
||||
|
||||
wt_candidates = [
|
||||
f"/mnt/c/Users/{win_user}/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json",
|
||||
f"/mnt/c/Users/{win_user}/AppData/Local/Packages/Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe/LocalState/settings.json",
|
||||
]
|
||||
|
||||
settings_path = next((Path(p) for p in wt_candidates if Path(p).exists()), None)
|
||||
|
||||
if not settings_path:
|
||||
print("Windows Terminal settings.json not found — skipping.")
|
||||
sys.exit(0)
|
||||
|
||||
with open(settings_path) as f:
|
||||
settings = json.load(f)
|
||||
|
||||
profiles = settings.setdefault("profiles", {}).setdefault("list", [])
|
||||
|
||||
if any(p.get("name") == "Promethean" for p in profiles):
|
||||
print("Promethean profile already exists — skipping.")
|
||||
sys.exit(0)
|
||||
|
||||
profiles.insert(0, {
|
||||
"guid": "{" + str(uuid.uuid4()) + "}",
|
||||
"name": "Promethean",
|
||||
"commandline": f"wsl.exe -d {distro} bash --init-file ~/.promethean_init",
|
||||
"startingDirectory": "~",
|
||||
"icon": icon_path,
|
||||
})
|
||||
|
||||
with open(settings_path, "w") as f:
|
||||
json.dump(settings, f, indent=4)
|
||||
|
||||
print(f"Promethean profile added to Windows Terminal ({settings_path.parent.parent.name}).")
|
||||
PYEOF
|
||||
|
||||
# Create desktop shortcut
|
||||
powershell.exe -command "
|
||||
\$ws = New-Object -ComObject WScript.Shell
|
||||
\$s = \$ws.CreateShortcut(\"\$env:USERPROFILE\Desktop\Promethean.lnk\")
|
||||
\$s.TargetPath = 'wt.exe'
|
||||
\$s.Arguments = '--profile Promethean'
|
||||
\$s.IconLocation = 'wt.exe,0'
|
||||
\$s.Save()
|
||||
" 2>/dev/null && echo "Desktop shortcut created." || echo "Could not create desktop shortcut — open Windows Terminal manually."
|
||||
}
|
||||
|
||||
# ─── Step 1: Sync from router ─────────────────────────────────────────────────
|
||||
|
||||
echo "Pulling Nexus from router..."
|
||||
mkdir -p "$NEXUS_ROOT"
|
||||
rsync -avz --delete \
|
||||
--exclude='Promethean/' \
|
||||
--exclude='models/blobs/' \
|
||||
--exclude='ollama/' \
|
||||
--exclude='interface/web/node_modules/' \
|
||||
--exclude='interface/web/dist/' \
|
||||
--exclude='runtime/' \
|
||||
--exclude='__pycache__/' \
|
||||
--exclude='*.pyc' \
|
||||
-e ssh \
|
||||
"$ROUTER_BACKUP" "$NEXUS_ROOT/"
|
||||
|
||||
# ─── Step 2: Python venv ──────────────────────────────────────────────────────
|
||||
|
||||
echo ""
|
||||
echo "Creating Python environment..."
|
||||
python3 -m venv "$NEXUS_ROOT/Promethean"
|
||||
|
||||
# ─── Step 3: pip install ──────────────────────────────────────────────────────
|
||||
|
||||
echo ""
|
||||
echo "Installing Python dependencies..."
|
||||
req=$(detect_requirements)
|
||||
echo "Detected: $req"
|
||||
if [ -f "$NEXUS_ROOT/$req" ]; then
|
||||
"$NEXUS_ROOT/Promethean/bin/pip" install --upgrade pip -q
|
||||
"$NEXUS_ROOT/Promethean/bin/pip" install -r "$NEXUS_ROOT/$req"
|
||||
else
|
||||
echo "Warning: $req not found — skipping pip install."
|
||||
fi
|
||||
|
||||
# ─── Step 4: npm install ──────────────────────────────────────────────────────
|
||||
|
||||
echo ""
|
||||
echo "Installing frontend dependencies..."
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
if command -v npm &>/dev/null; then
|
||||
cd "$NEXUS_ROOT/interface/web" && npm install
|
||||
else
|
||||
echo "npm not found — install nvm/node then run 'cd $NEXUS_ROOT/interface/web && npm install'."
|
||||
fi
|
||||
|
||||
# ─── Step 5: Register ncp in ~/.bashrc ───────────────────────────────────────
|
||||
|
||||
echo ""
|
||||
echo "Registering ncp..."
|
||||
if ! grep -q "nexus-core/management/nexus-cli.sh" "$HOME/.bashrc"; then
|
||||
cat >> "$HOME/.bashrc" << 'EOF'
|
||||
|
||||
# Nexus
|
||||
ncp() {
|
||||
~/nexus-core/management/nexus-cli.sh "$@"
|
||||
}
|
||||
alias promethean='source ~/.promethean_bashrc'
|
||||
EOF
|
||||
echo "ncp registered in ~/.bashrc."
|
||||
else
|
||||
echo "ncp already in ~/.bashrc — skipping."
|
||||
fi
|
||||
|
||||
# ─── Step 6: Windows Terminal + desktop shortcut ──────────────────────────────
|
||||
|
||||
if is_wsl; then
|
||||
echo ""
|
||||
echo "Configuring Windows environment..."
|
||||
setup_windows || true
|
||||
echo ""
|
||||
echo "Reload your shell or open a new terminal for ncp to take effect."
|
||||
fi
|
||||
|
||||
# ─── Done ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
echo ""
|
||||
echo "Installation complete. Nexus is ready."
|
||||
if is_wsl; then
|
||||
echo "Open Windows Terminal → Promethean profile, or use the desktop shortcut."
|
||||
else
|
||||
echo "Run 'ncp start' to launch Nexus."
|
||||
fi
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
export GDK_PROGRAM_CLASS=promethean-terminal
|
||||
exec xfce4-terminal --working-directory ~ -e "bash --rcfile ~/.promethean_bashrc -i" "$@"
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
NEXUS_ROOT="$HOME/nexus-core"
|
||||
|
||||
detect_requirements() {
|
||||
if command -v nvidia-smi &>/dev/null || lspci 2>/dev/null | grep -qi nvidia; then
|
||||
echo "nvidia_requirements.txt"
|
||||
else
|
||||
echo "amd_requirements.txt"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Restoring full Nexus backup from router..."
|
||||
lftp sftp://router:2022 << 'LFTP'
|
||||
set sftp:connect-program "ssh -a -x -p 2022"
|
||||
set cmd:interactive yes
|
||||
mirror --delete --verbose --dereference --exclude "^Promethean/" --exclude "^models/blobs/" --exclude "^ollama/" --exclude "^interface/web/node_modules/" --exclude "^interface/web/dist/" --exclude "^runtime/" --exclude "__pycache__" --exclude "\.pyc$" /Wingdrive2/nexus-backup /home/jon/nexus-core
|
||||
quit
|
||||
LFTP
|
||||
|
||||
echo ""
|
||||
echo "Rebuilding Python environment..."
|
||||
req=$(detect_requirements)
|
||||
if [ -f "$NEXUS_ROOT/$req" ]; then
|
||||
"$NEXUS_ROOT/Promethean/bin/pip" install -r "$NEXUS_ROOT/$req"
|
||||
else
|
||||
echo "Warning: $req not found — skipping pip install."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Rebuilding frontend dependencies..."
|
||||
cd "$NEXUS_ROOT/interface/web" && npm install
|
||||
|
||||
echo ""
|
||||
echo "Restore complete. Nexus is ready to start."
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
NEXUS_ROOT="$HOME/nexus-core"
|
||||
|
||||
detect_requirements() {
|
||||
if command -v nvidia-smi &>/dev/null || lspci 2>/dev/null | grep -qi nvidia; then
|
||||
echo "nvidia_requirements.txt"
|
||||
else
|
||||
echo "amd_requirements.txt"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Restoring Nexus from router..."
|
||||
rsync -avz --delete \
|
||||
--exclude='Promethean/' \
|
||||
--exclude='models/blobs/' \
|
||||
--exclude='ollama/' \
|
||||
--exclude='interface/web/node_modules/' \
|
||||
--exclude='interface/web/dist/' \
|
||||
--exclude='runtime/' \
|
||||
--exclude='__pycache__/' \
|
||||
--exclude='*.pyc' \
|
||||
-e ssh \
|
||||
"router:/tmp/mnt/Wingdrive2/nexus-backup/" "$NEXUS_ROOT/"
|
||||
|
||||
echo ""
|
||||
echo "Rebuilding Python environment..."
|
||||
req=$(detect_requirements)
|
||||
if [ -f "$NEXUS_ROOT/$req" ]; then
|
||||
"$NEXUS_ROOT/Promethean/bin/pip" install -r "$NEXUS_ROOT/$req"
|
||||
else
|
||||
echo "Warning: $req not found — skipping pip install."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Rebuilding frontend dependencies..."
|
||||
cd "$NEXUS_ROOT/interface/web" && npm install
|
||||
|
||||
echo ""
|
||||
echo "Restore complete. Nexus is ready to start."
|
||||
Reference in New Issue
Block a user