preparing directories for transition to multi-host flake setup

This commit is contained in:
jeirmeister 2024-11-06 12:29:11 -08:00
parent d475f895a0
commit a115537e6e
Signed by: jeirmeister
GPG Key ID: 33A40DF62D35C4A7
79 changed files with 264 additions and 318 deletions

View File

@ -1,3 +0,0 @@
{
"users/jeirmeister/programs/shell/terminals/kitty.nix": "{ config, pkgs, ... }:\n\n{\n programs.kitty = {\n enable = true;\n settings = {\n font_family = \"JetBrains Mono\";\n font_size = 12;\n window_padding_width = 4;\n background_opacity = \"0.95\";\n hide_window_decorations = \"yes\";\n tab_bar_style = \"powerline\";\n \n # Dracula theme colors\n foreground = \"#F8F8F2\";\n background = \"#282A36\";\n selection_foreground = \"#ffffff\";\n selection_background = \"#44475a\";\n url_color = \"#8be9fd\";\n cursor = \"#f8f8f2\";\n\n # black\n color0 = \"#21222c\";\n color8 = \"#6272a4\";\n\n # red\n color1 = \"#ff5555\";\n color9 = \"#ff6e6e\";\n\n # green\n color2 = \"#50fa7b\";\n color10 = \"#69ff94\";\n\n # yellow\n color3 = \"#f1fa8c\";\n color11 = \"#ffffa5\";\n\n # blue\n color4 = \"#bd93f9\";\n color12 = \"#d6acff\";\n\n # magenta\n color5 = \"#ff79c6\";\n color13 = \"#ff92df\";\n\n # cyan\n color6 = \"#8be9fd\";\n color14 = \"#a4ffff\";\n\n # white\n color7 = \"#f8f8f2\";\n color15 = \"#ffffff\";\n\n # tab bar\n active_tab_foreground = \"#282a36\";\n active_tab_background = \"#f8f8f2\";\n inactive_tab_foreground = \"#282a36\";\n inactive_tab_background = \"#6272a4\";\n };\n };\n}"
}

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
# README # ------
# Configure the config.json file in this same directory for an AI chatbot to
# Assist in making direct changes to files.
set -euo pipefail
# Make sure jq is available
if ! command -v jq &> /dev/null; then
echo "Error: jq is required but not installed"
exit 1
fi
# Make sure config.json exists
if [ ! -f "config.json" ]; then
echo "Error: config.json not found in current directory"
exit 1
fi
echo "Creating directories and files..."
# Process each key in the JSON configuration
for file in $(jq -r 'keys[]' config.json); do
# Create directory if it doesn't exist
dir=$(dirname "$file")
mkdir -p "$dir"
# Write content to file
jq -r --arg file "$file" '.[$file]' config.json > "$file"
echo "Created: $file"
done
echo "Configuration files have been created successfully!"

View File

@ -1,38 +0,0 @@
# NixOS Steam Deck Recovery Procedures
This documentation covers recovery procedures for NixOS on Steam Deck. It was created based on real recovery scenarios and provides practical solutions for common issues.
## Quick Reference
1. Boot Issues
- [Boot Recovery Guide](./boot-recovery.md)
- Common root causes: filesystem mounts, hardware configuration
2. Network Issues
- [Network Recovery Guide](./network-recovery.md)
- Essential for rebuilding with Jovian packages
3. Filesystem Issues
- [Filesystem Troubleshooting](./filesystem-issues.md)
- Handling mount points and permissions
## Emergency Recovery Steps
1. Boot into emergency mode
2. Establish network connectivity
3. Fix configuration issues
4. Rebuild system
5. Verify and reboot
## Prevention Strategies
1. Maintain separate configurations:
- Main configuration
- Minimal fallback configuration
- Hardware-specific configuration
2. Regular backups of working configurations
3. Testing changes in VM before applying
4. Maintaining recovery tools and scripts

View File

@ -1,19 +0,0 @@
# Recovery Scripts
This directory contains scripts for automating common recovery tasks.
## Available Scripts
1. `network-recovery.sh`
- Automates network setup in emergency environment
- Handles both ethernet and wifi configurations
- Usage: `sudo ./network-recovery.sh`
## Script Development Guidelines
1. All scripts should:
- Include clear documentation
- Handle errors gracefully
- Provide status feedback
- Support both automatic and interactive modes
- Create backups before making changes

View File

@ -1,146 +0,0 @@
#!/usr/bin/env bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print status messages
print_status() {
echo -e "${GREEN}[*]${NC} $1"
}
print_error() {
echo -e "${RED}[!]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[!]${NC} $1"
}
# Find ethernet interface
find_interface() {
local interface=$(ip link show | grep enp | cut -d: -f2 | tr -d ' ' | head -n1)
if [ -z "$interface" ]; then
print_error "No ethernet interface found"
exit 1
}
echo "$interface"
}
# Prompt for network configuration
get_network_config() {
local default_interface=$(find_interface)
echo "Current network interfaces:"
ip link show
read -p "Enter interface name [$default_interface]: " interface
interface=${interface:-$default_interface}
read -p "Enter static IP address (e.g., 10.0.0.68): " static_ip
read -p "Enter gateway IP address (e.g., 10.0.0.1): " gateway_ip
# Validate IP addresses
if [[ ! $static_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
print_error "Invalid static IP format"
exit 1
}
if [[ ! $gateway_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
print_error "Invalid gateway IP format"
exit 1
}
}
# Configure network
setup_network() {
print_status "Setting up network interface $interface..."
# Clear any existing IP addresses
ip addr flush dev $interface
# Bring up interface
ip link set $interface up
if [ $? -ne 0 ]; then
print_error "Failed to bring up interface"
exit 1
}
# Add IP address
ip addr add $static_ip/24 dev $interface
if [ $? -ne 0 ]; then
print_error "Failed to set IP address"
exit 1
}
# Remove any existing default routes
ip route del default 2>/dev/null
# Add default route
ip route add default via $gateway_ip dev $interface
if [ $? -ne 0 ]; then
print_error "Failed to add default route"
exit 1
}
# Configure DNS
print_status "Configuring DNS..."
echo "nameserver $gateway_ip" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
# Disable IPv6
print_status "Disabling IPv6..."
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
sysctl -w net.ipv6.conf.lo.disable_ipv6=1
}
# Test connectivity
test_connectivity() {
print_status "Testing connectivity..."
# Test local network
print_status "Pinging gateway..."
if ! ping -c 1 $gateway_ip >/dev/null 2>&1; then
print_error "Cannot ping gateway"
return 1
}
# Test DNS resolution
print_status "Testing DNS resolution..."
if ! ping -c 1 github.com >/dev/null 2>&1; then
print_warning "DNS resolution failed"
return 1
}
print_status "Network setup complete and functional!"
return 0
}
# Main execution
main() {
if [[ $EUID -ne 0 ]]; then
print_error "This script must be run as root"
exit 1
}
print_status "NixOS Network Recovery Script"
print_status "==============================="
get_network_config
setup_network
test_connectivity
if [ $? -eq 0 ]; then
print_status "You should now be able to run nixos-rebuild"
else
print_error "Network setup completed but connectivity test failed"
print_warning "Check your network settings and try again"
fi
}
# Run main function
main "$@"

View File

@ -1,51 +0,0 @@
# Common Issues and Solutions
## Network Configuration Issues
### Symptoms
- Unable to fetch packages
- No internet connectivity in emergency mode
### Solution
1. Use network-recovery.sh script
2. Manual network configuration:
```bash
ip link set INTERFACE up
ip addr add IP_ADDRESS/24 dev INTERFACE
ip route add default via GATEWAY
echo "nameserver 8.8.8.8" > /etc/resolv.conf
```
## Filesystem Mount Issues
### Symptoms
- Read-only filesystem errors
- Unable to modify configuration
- Failed mounts during boot
### Solution
1. Identify problematic mounts:
```bash
mount | grep ro
lsblk -f
```
2. Remount filesystems:
```bash
mount -o remount,rw /
mount -o remount,rw /nix/store
```
3. Check/modify hardware-configuration.nix
## DBus Issues
### Symptoms
- Failed to connect to bus
- Service startup failures
### Solution
1. Setup minimal DBus environment:
```bash
mkdir -p /run/dbus
mount -t tmpfs tmpfs /run
dbus-daemon --system --fork
```

View File

@ -1,29 +0,0 @@
# Jovian NixOS Specific Issues
## Package Fetching Issues
### Symptoms
- Unable to fetch Jovian packages
- Build failures related to Jovian components
### Solution
1. Ensure network connectivity
2. Verify Jovian configuration:
```nix
jovian = {
hardware.has.amd.gpu = true;
devices.steamdeck.enable = true;
};
```
3. Check Jovian cache availability
## Hardware Detection Issues
### Symptoms
- Missing Steam Deck specific features
- Hardware not properly recognized
### Solution
1. Verify hardware configuration
2. Check kernel modules
3. Review Jovian hardware settings

View File

@ -0,0 +1,225 @@
{ pkgs, lib, ... }:
let
jovianNixosRev = "f6423d86bec22c25a576b23262495c5536b0d069";
jovianNixos = builtins.fetchTarball {
url = "https://github.com/Jovian-Experiments/Jovian-NixOS/archive/${jovianNixosRev}.tar.gz";
sha256 = "sha256:1frd1dfqd97idwf1rj29ab0wvyfa2nx2h3bp9hkbmfa1m802avmb";
};
v4l2loopback-options = {
options = {
exclusive_caps = 1;
video_nr = 0;
card_label = "Immersed Virtual Camera";
};
};
in
{
imports = [
./hardware-configuration.nix
(jovianNixos + "/modules")
];
# Basic System Configuration
system.stateVersion = "24.05";
networking = {
hostName = "steamnix";
networkmanager.enable = true;
};
time.timeZone = "America/Los_Angeles";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
# Nix Package Manager Configuration
nixpkgs = {
overlays = [
(import (jovianNixos + "/overlay.nix"))
];
config.allowUnfree = true;
};
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "cache.nixos.org" ];
allowed-users = [ "@wheel" "jeirmeister" ];
auto-optimise-store = true;
};
# Steam Deck Specific Configuration
jovian = {
hardware.has.amd.gpu = true;
devices.steamdeck = {
enable = true;
enableControllerUdevRules = true;
enableDefaultStage1Modules = true;
enablePerfControlUdevRules = true;
enableOsFanControl = true;
enableSoundSupport = true;
enableXorgRotation = true;
enableKernelPatches = true;
enableFwupdBiosUpdates = false;
autoUpdate = false;
};
steam.enable = false;
workarounds.ignoreMissingKernelModules = true;
};
# Hardware and Display Configuration
hardware.video = {
displaylink.enable = true;
};
# Desktop Environment and Display Configuration
services.xserver = {
enable = true;
xkb.layout = "us";
videoDrivers = [ "displaylink" "modesetting" ];
desktopManager.plasma6 = {
enable = true;
extraSessionCommands = ''
${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0;
'';
};
displayManager = {
sddm = {
enable = true;
wayland = true;
};
sessionCommands = ''
${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0
'';
};
};
# System Services Configuration
services = {
# Audio Configuration
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# Network Services
openssh = {
enable = true;
settings = {
PasswordAuthentication = true;
AllowUsers = [ "jeirmeister" ];
};
};
tailscale.enable = true;
};
# Systemd Services
systemd.services = {
jupiter-fan-control = {
path = [ pkgs.dmidecode ];
serviceConfig = lib.mkForce {
Environment = "PYTHONUNBUFFERED=1";
StandardOutput = "journal";
StandardError = "journal";
ExecStart = "${pkgs.jupiter-fan-control}/share/jupiter-fan-control/fancontrol.py --run";
ExecStopPost = "${pkgs.jupiter-fan-control}/share/jupiter-fan-control/fancontrol.py --stop";
OOMScoreAdjust = -1000;
Restart = "on-failure";
};
};
"systemd-modules-load" = {
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
};
};
# UDev Rules
services.udev.extraRules = ''
SUBSYSTEM=="hwmon*", KERNEL=="hwmon*", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+rw /sys/%p/pwm1"
SUBSYSTEM=="hwmon*", KERNEL=="hwmon*", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+rw /sys/%p/fan1_input"
'';
# User Configuration
users = {
users.jeirmeister = {
isNormalUser = true;
description = "jeirmeister";
group = "steamos";
extraGroups = [
"networkmanager"
"users"
"wheel"
"input"
"video"
"audio"
"render"
"gamepad"
];
packages = with pkgs; [
tailscale
];
};
groups = {
steamos.gid = 1000;
gamepad = {};
render = {};
};
};
# System Programs and Packages
programs = {
firefox.enable = true;
};
environment.systemPackages = with pkgs; [
# System Tools
pciutils
usbutils
lm_sensors
dmidecode
binutils
# Virtual Display
linuxPackages.v4l2loopback
v4l-utils
# Development Tools
nixfmt-rfc-style
git
# Network Tools
wget
curl
# Utilities
tree
];
}
# TODO: Incorporate this part later
# Immersed Video Service
# immersed-video = {
# description = "Load v4l2loopback module for Immersed";
# wantedBy = [ "multi-user.target" ];
# after = [ "systemd-modules-load.service" ];
# requires = [ "systemd-modules-load.service" ];
# serviceConfig = {
# Type = "oneshot";
# RemainAfterExit = true;
# ExecStartPre = "${pkgs.kmod}/bin/modprobe -r v4l2loopback || true";
# ExecStart = "${pkgs.kmod}/bin/modprobe v4l2loopback exclusive_caps=1 video_nr=0 card_label='Immersed Virtual Camera'";
# ExecStop = "${pkgs.kmod}/bin/rmmod v4l2loopback || true";
# };
# };

View File

@ -0,0 +1,39 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f3cc4aae-428e-435d-b9f7-333f7dad06b2";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/580E-5E90";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0f3u1u4u3.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

View File