diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d6de57b --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ + +MIT No Attribution + +Copyright 2025 Serenity-F + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/README.md b/README.md new file mode 100755 index 0000000..01c5fc1 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +
+ +# SerenityOS + +_Declarative NixOS configuration with Flakes & Home Manager_
+ (no it's not the ladybug) + +[![NixOS](https://img.shields.io/badge/NixOS-Unstable-blue?style=for-the-badge&logo=NixOS&logoColor=white&label=NixOS&labelColor=303446&color=91D7E3)](https://nixos.org) +[![License](https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&colorA=313244&colorB=F5A97F&logo=unlicense&logoColor=F5A97F&)](https://codeberg.org/Serenity-F/SerenityOS/src/branch/main/LICENSE) + +
+ +
+ +![screenshot](https://codeberg.org/serenity-F/SerenityOS/raw/branch/main/assets/repository/desktop-screenshot.png) + +## 💻 System Information + +### Software In Use + +| Component | Implementation | +| ------------------ | ------------------------------------ | +| **OS** | NixOS Unstable | +| **Display Server** | Wayland | +| **Session Manager**| Regreet | +| **Window Manager** | Niri | +| **Desktop** | Noctalia | +| **Terminal** | Kitty | +| **Shell** | Fish | +| **Editor** | Helix | +| **Browser** | Firefox | +| **File Manager** | Yazi | +| **Themeing** | Stylix | +| **Filesystem** | Ext4, Btrfs, or ZFS (host-dependent) | + +### Local machine profile: `fractal` + +The `fractal` host targets Porta's MSI MS-7C95 desktop (AMD Ryzen 5 5500, NVIDIA GeForce RTX 5060 Ti, Intel Wireless-AC 3168 Wi-Fi/Bluetooth, and x86_64 UEFI). It enables the Niri/Noctalia desktop, terminal tools, gaming, and multimedia modules. The configured displays are HDMI-A-1 at 1920×1080/180 Hz and DP-2 at 1920×1080/60 Hz. + +The host configuration does not select or partition a disk. Before installing NixOS, decide which drive and filesystem to use, generate its filesystem configuration, and add the resulting UUIDs to the `fractal-hardware` module. This machine currently runs Arch Linux, so the profile has not been installed or switched on the running system. + +The account is configured as `porta` and uses the local Git identity. No login password is stored in the Nix configuration; after mounting the installed system at `/mnt`, set one before the first normal login with `nixos-enter --root /mnt -c 'passwd porta'`. + +### Common Commands + +| Command | Description | +| ------------------------------------------ | -------------------------------------------------- | +| `hx ` | Edit file | +| `nix flake update` | Update system | +| `git add --all && git commit -m ""`| Save system changes or updates to git tree | +| `sudo nixos-rebuild test --flake .#` | Test changes or updates without switching | +| `sudo nixos-rebuild switch --flake .#`| Apply system changes or updates | + +## 📋 To-Do List + + - [Enable multi-user functionality](https://codeberg.org/serenity-F/SerenityOS/milestone/145563) + - [Provide a wiki for this config](https://codeberg.org/serenity-F/SerenityOS/milestone/145569) + - [Provide an installer ISO or script](https://codeberg.org/serenity-F/SerenityOS/milestone/145563) + +## 📝 Dev Notes + +For the purposes of authenticity and earnestness + + - I will not rebase or squash any commits + - I will not remove any outdated branches + +## 📜 License + +- MIT License: Feel free to use and modify as you wish. + +## 📚 Learning Resources + +- [NixOS Manual](https://nixos.org/manual/nixos/stable/) +- [Nix Pills](https://nixos.org/guides/nix-pills/) +- [Home Manager](https://nix-community.github.io/home-manager/) +- [Niri Flake](https://github.com/epireyn/niri-flake) +- [Stylix](https://stylix.danth.me/) +- [Nixflix](https://kiriwalawren.github.io/nixflix/) + +## 🙋 Attributions + + ### Artwork + + - [Helvetica Blanc](https://helveticablanc.com/) + - [Vincent Van Gogh](https://en.wikipedia.org/wiki/Almond_Blossoms/) + + ### Code + + - [V3rm1n](https://codeberg.org/v3rm1n/dotfiles/) + - [Sashanoraa](https://codeberg.org/sashanoraa/nixcfg/) +- [Quantenzitrone](https://codeberg.org/quantenzitrone/nixos-config/) + +
+ +
+ +_Built with 🩵_ + +
diff --git a/install.conf b/install.conf deleted file mode 100644 index b85b2ad..0000000 --- a/install.conf +++ /dev/null @@ -1,47 +0,0 @@ -# ============================================ -# SerenityOS Installer Configuration -# ============================================ -# Default values for the interactive installer. -# These can be overridden by the interactive prompts. -# ============================================ - -# Host configuration to use: usb, hades, or template -HOST="usb" - -# Disk to install to (e.g., /dev/sda, /dev/nvme0n1) -DISK="/dev/sda" - -# Partition scheme: "ext4" or "zfs" -FILESYSTEM="ext4" - -# Enable encryption? (true/false) -# For ZFS: uses ZFS native encryption -# For Ext4: uses LUKS -ENCRYPT=true - -# System hostname -HOSTNAME="serenity-os" - -# User settings -USERNAME="serenity" -PASSWORD="password" - -# Git settings -GIT_USER="serenity-F" -GIT_EMAIL="serenity-F@noreply.codeberg.org" - -# Locale and timezone -LOCALE="en_AU.UTF-8" -TIMEZONE="Australia/Brisbane" - -# GPU support (auto-detected, but can be overridden) -# Set to "true" to force enable, "false" to force disable -ENABLE_NVIDIA="" -ENABLE_AMD="" - -# Feature flags (for desktop installs) -ENABLE_GAMING=true -ENABLE_MEDIA_SERVER=false -ENABLE_VR=false -ENABLE_MUSIC=false -ENABLE_BLUETOOTH=true diff --git a/install.sh b/install.sh deleted file mode 100755 index cf634ed..0000000 --- a/install.sh +++ /dev/null @@ -1,658 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# ============================================ -# SerenityOS NixOS Interactive Installer -# ============================================ -# Supports: Ext4/ZFS, LUKS encryption, AMD/NVIDIA GPUs -# Usage: sudo ./install.sh -# ============================================ - -# Source default configuration -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "$SCRIPT_DIR/install.conf" - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -CYAN='\033[0;36m' -BOLD='\033[1m' -NC='\033[0m' - -# ============================================ -# Helper functions -# ============================================ - -log() { echo -e "${GREEN}[*]${NC} $1"; } -warn() { echo -e "${YELLOW}[!]${NC} $1"; } -error() { echo -e "${RED}[x]${NC} $1"; exit 1; } -info() { echo -e "${BLUE}[i]${NC} $1"; } -step() { echo -e "\n${CYAN}${BOLD}=== $1 ===${NC}\n"; } - -prompt() { - local prompt_text="$1" - local default="$2" - local result - read -rp "$(echo -e "${BOLD}$prompt_text${NC} [${default}]: ")" result - echo "${result:-$default}" -} - -prompt_password() { - local prompt_text="$1" - local result - read -rsp "$(echo -e "${BOLD}$prompt_text${NC}: ")" result - echo "" - echo "$result" -} - -prompt_yn() { - local prompt_text="$1" - local default="${2:-y}" - local result - read -rp "$(echo -e "${BOLD}$prompt_text${NC} [${default}]: ")" result - result="${result:-$default}" - [[ "$result" =~ ^[Yy]$ ]] -} - -prompt_choice() { - local prompt_text="$1" - shift - local options=("$@") - local choice - - echo -e "${BOLD}$prompt_text${NC}" - for i in "${!options[@]}"; do - echo " $((i+1))) ${options[$i]}" - done - - while true; do - read -rp "$(echo -e "${BOLD}Select [1-${#options[@]}]: ${NC}")" choice - if [[ "$choice" =~ ^[0-9]+$ ]] && \ - (( choice >= 1 && choice <= ${#options[@]} )); then - echo "${options[$((choice-1))]}" - return - fi - warn "Invalid selection. Please try again." - done -} - -# ============================================ -# 1. Welcome & Environment Check -# ============================================ - -step "Welcome to SerenityOS Installer" - -echo -e "${CYAN}" -printf '%s\n' \ - "███████╗███████╗██████╗ ███████╗███╗ ██╗██╗████████╗██╗ ██╗" \ - "██╔════╝██╔════╝██╔══██╗██╔════╝████╗ ██║╚══██╔══╝╚██╗ ██╔╝" \ - "███████╗█████╗ ██████╔╝█████╗ ██╔██╗ ██║ ██║ ╚████╔╝ " \ - "╚════██║██╔══╝ ██╔══██╗██╔══╝ ██║╚██╗██║ ██║ ╚██╔╝ " \ - "███████║███████╗██║ ██║███████╗██║ ╚████║ ██║ ██║ " \ - "╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ " -echo -e "${NC}" - -log "Verifying installation environment..." - -# Check we're running as root -if [[ $EUID -ne 0 ]]; then - error "This script must be run as root (use sudo or boot as root)" -fi - -# Check we're in the NixOS installer -if [[ ! -f /etc/nixos/configuration.nix ]]; then - error "This script must be run from the NixOS minimal installer" -fi - -# Check network connectivity -log "Checking network connectivity..." -if ! ping -c 1 -W 5 1.1.1.1 &>/dev/null; then - warn "No network connection detected." - if ! prompt_yn "Continue anyway?" "n"; then - error "Please configure networking and try again." - fi -fi - -# Check git is available -if ! command -v git &>/dev/null; then - warn "git not found, installing..." - nix-env -iA nixpkgs.git -fi - -log "Environment verified." - -# ============================================ -# 2. Detect Hardware -# ============================================ - -step "Hardware Detection" - -# Detect CPU -CPU_VENDOR=$(grep -m1 'vendor_id' /proc/cpuinfo | awk '{print $3}') -info "CPU Vendor: $CPU_VENDOR" - -# Detect GPU -GPU_INFO=$(lspci -nn | grep -i 'vga\|3d\|display' || true) -info "Detected GPUs:" -echo "$GPU_INFO" | while read -r line; do - echo " $line" -done - -# Detect NVIDIA GPU -NVIDIA_GPU=false -if echo "$GPU_INFO" | grep -qi "nvidia"; then - NVIDIA_GPU=true - info "NVIDIA GPU detected" -fi - -# Detect AMD GPU -AMD_GPU=false -if echo "$GPU_INFO" | grep -qi "amd\|ati"; then - AMD_GPU=true - info "AMD GPU detected" -fi - -# Detect Intel GPU -INTEL_GPU=false -if echo "$GPU_INFO" | grep -qi "intel"; then - INTEL_GPU=true - info "Intel GPU detected" -fi - -# Detect if running in VM -IS_VM=false -if systemd-detect-virt &>/dev/null && [[ "$(systemd-detect-virt)" != "none" ]]; then - IS_VM=true - info "Running in a VM: $(systemd-detect-virt)" -fi - -# ============================================ -# 3. Configure Installation -# ============================================ - -step "Installation Configuration" - -# Select host configuration -HOST=$(prompt_choice "Select host configuration:" "usb" "hades" "template") -info "Selected host: $HOST" - -# Select disk -echo "" -log "Available disks:" -lsblk -d -o NAME,SIZE,MODEL,TRAN | grep -v "loop\|rom" -echo "" - -while true; do - DISK=$(prompt "Enter disk to install to" "$DISK") - if [[ -b "$DISK" ]]; then - break - fi - warn "Disk $DISK does not exist. Please try again." -done - -# Show disk info -info "Selected disk: $DISK" -lsblk "$DISK" -o NAME,SIZE,FSTYPE,MOUNTPOINT -echo "" - -# Confirm disk selection -if ! prompt_yn "WARNING: This will DESTROY all data on $DISK. Continue?" "n"; then - error "Installation cancelled." -fi - -# Select filesystem -FILESYSTEM=$(prompt_choice "Select filesystem:" "ext4" "zfs") -info "Selected filesystem: $FILESYSTEM" - -# Encryption -ENCRYPT=false -if [[ "$FILESYSTEM" == "zfs" ]]; then - if prompt_yn "Enable ZFS native encryption?" "y"; then - ENCRYPT=true - fi -else - if prompt_yn "Enable LUKS encryption?" "y"; then - ENCRYPT=true - fi -fi - -# Hostname -HOSTNAME=$(prompt "Enter hostname" "$HOSTNAME") -info "Hostname: $HOSTNAME" - -# Username -USERNAME=$(prompt "Enter username" "$USERNAME") -info "Username: $USERNAME" - -# Password -echo "" -PASSWORD=$(prompt_password "Enter password for $USERNAME") -if [[ -z "$PASSWORD" ]]; then - error "Password cannot be empty" -fi -PASSWORD_CONFIRM=$(prompt_password "Confirm password") -if [[ "$PASSWORD" != "$PASSWORD_CONFIRM" ]]; then - error "Passwords do not match" -fi - -# Git configuration -echo "" -GIT_USER=$(prompt "Git username" "$GIT_USER") -GIT_EMAIL=$(prompt "Git email" "$GIT_EMAIL") - -# Locale and timezone -echo "" -LOCALE=$(prompt "Locale" "$LOCALE") -TIMEZONE=$(prompt "Timezone" "$TIMEZONE") - -# GPU configuration -echo "" -if [[ "$NVIDIA_GPU" == true ]]; then - if prompt_yn "Enable NVIDIA GPU support?" "y"; then - ENABLE_NVIDIA=true - else - ENABLE_NVIDIA=false - fi -fi - -if [[ "$AMD_GPU" == true ]]; then - if prompt_yn "Enable AMD GPU support?" "y"; then - ENABLE_AMD=true - else - ENABLE_AMD=false - fi -fi - -# Feature selection (for desktop installs) -if [[ "$HOST" != "usb" ]]; then - echo "" - step "Feature Selection" - - ENABLE_GAMING=false - ENABLE_MEDIA_SERVER=false - ENABLE_VR=false - ENABLE_MUSIC=false - ENABLE_BLUETOOTH=false - - if prompt_yn "Enable gaming (Steam, Lutris, etc.)?" "y"; then - ENABLE_GAMING=true - fi - - if prompt_yn "Enable media server (Jellyfin, etc.)?" "n"; then - ENABLE_MEDIA_SERVER=true - fi - - if prompt_yn "Enable VR support?" "n"; then - ENABLE_VR=true - fi - - if prompt_yn "Enable music production (DAW, etc.)?" "n"; then - ENABLE_MUSIC=true - fi - - if prompt_yn "Enable Bluetooth?" "y"; then - ENABLE_BLUETOOTH=true - fi -fi - -# ============================================ -# 4. Partition and Format Disk -# ============================================ - -step "Partitioning Disk" - -log "Wiping disk $DISK..." -wipefs -af "$DISK" -sgdisk --zap-all "$DISK" 2>/dev/null || true - -if [[ "$FILESYSTEM" == "zfs" ]]; then - log "Creating ZFS partitions..." - - # ZFS partitioning: 1GiB boot, rest for ZFS - parted -s "$DISK" -- \ - mklabel gpt \ - mkpart ESP fat32 1MiB 1GiB \ - set 1 esp on \ - mkpart primary 1GiB 100% - - # Wait for partition table to sync - sleep 2 - partprobe "$DISK" 2>/dev/null || true - sleep 1 - - # Format boot partition - mkfs.fat -F32 -n boot "${DISK}1" - - # Create ZFS pool - if [[ "$ENCRYPT" == true ]]; then - # ZFS native encryption - zpool create -f \ - -o ashift=12 \ - -O compression=zstd \ - -O xattr=sa \ - -O acltype=posixacl \ - -O encryption=aes-256-gcm \ - -O keyformat=passphrase \ - -O mountpoint=none \ - rpool "${DISK}2" - else - # No encryption - zpool create -f \ - -o ashift=12 \ - -O compression=zstd \ - -O xattr=sa \ - -O acltype=posixacl \ - -O mountpoint=none \ - rpool "${DISK}2" - fi - - # Create ZFS datasets - zfs create -o mountpoint=legacy rpool/root - zfs create -o mountpoint=legacy rpool/home - zfs create -o mountpoint=legacy rpool/nix - - # Mount filesystems - mount -t zfs rpool/root /mnt - mkdir -p /mnt/home /mnt/nix /mnt/boot - mount -t zfs rpool/home /mnt/home - mount -t zfs rpool/nix /mnt/nix - mount /dev/disk/by-label/boot /mnt/boot - - # Generate hostId for ZFS - HOSTID=$(head -c 8 /dev/urandom | od -An -tx1 | tr -d ' \n') - info "Generated hostId: $HOSTID" - -else - log "Creating Ext4 partitions..." - - # Ext4 partitioning: 1GiB boot, 8GiB swap, rest for root - parted -s "$DISK" -- \ - mklabel gpt \ - mkpart ESP fat32 1MiB 1GiB \ - set 1 esp on \ - mkpart primary linux-swap 1GiB 9GiB \ - mkpart primary 9GiB 100% - - # Wait for partition table to sync - sleep 2 - partprobe "$DISK" 2>/dev/null || true - sleep 1 - - # Format boot partition - mkfs.fat -F32 -n boot "${DISK}1" - - if [[ "$ENCRYPT" == true ]]; then - # LUKS encryption - log "Setting up LUKS encryption..." - echo -n "$PASSWORD" | cryptsetup luksFormat --type luks2 "${DISK}3" - - echo -n "$PASSWORD" | cryptsetup open "${DISK}3" luks-root - - - mkfs.ext4 -L nixos /dev/mapper/luks-root - mount /dev/mapper/luks-root /mnt - else - # No encryption - mkfs.ext4 -L nixos "${DISK}3" - mount /dev/disk/by-label/nixos /mnt - fi - - # Setup swap - mkswap -L swap "${DISK}2" - swapon "${DISK}2" - - # Mount boot - mkdir -p /mnt/boot - mount /dev/disk/by-label/boot /mnt/boot -fi - -log "Disk partitioned and formatted successfully." - -# ============================================ -# 5. Clone & Configure Repository -# ============================================ - -step "Setting Up Configuration" - -# Enable flakes -log "Enabling Nix flakes..." -mkdir -p /etc/nix -echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf - -# Clone the repository -if [[ -d /mnt/etc/nixos/.git ]]; then - log "Repository already exists, pulling latest..." - cd /mnt/etc/nixos - git pull -else - log "Cloning SerenityOS configuration..." - git clone https://codeberg.org/Serenity-F/SerenityOS /mnt/etc/nixos -fi - -cd /mnt/etc/nixos - -# Generate hardware configuration -log "Generating hardware configuration..." -nixos-generate-config --root /mnt - -# ============================================ -# 6. Customize Configuration -# ============================================ - -step "Customizing Configuration" - -# Update user.nix -log "Updating user configuration..." -sed -i "s/username = \".*\"/username = \"$USERNAME\"/" modules/system/user.nix -sed -i "s|home-directory = \".*\"|home-directory = \"/home/$USERNAME/\"|" modules/system/user.nix -sed -i "s/default-locale = \".*\"/default-locale = \"$LOCALE\"/" modules/system/user.nix -sed -i "s/username = \".*\"/username = \"$GIT_USER\"/" modules/system/user.nix -sed -i "s/email = \".*\"/email = \"$GIT_EMAIL\"/" modules/system/user.nix - -# Update core.nix -log "Updating system configuration..." -sed -i "s/time.timeZone = \".*\"/time.timeZone = \"$TIMEZONE\"/" modules/system/core.nix -sed -i "s/defaultLocale = \".*\"/defaultLocale = \"$LOCALE\"/" modules/system/core.nix - -# Update hostname in host config -if [[ "$HOST" == "template" ]]; then - log "Updating template hostname..." - sed -i "s/networking.hostName = \".*\"/networking.hostName = \"$HOSTNAME\"/" \ - "modules/system/hosts/template/default.nix" -fi - -# Configure GPU support -log "Configuring GPU support..." - -if [[ "$NVIDIA_GPU" == true && "${ENABLE_NVIDIA:-false}" == true ]]; then - info "Enabling NVIDIA GPU support..." - - # Create NVIDIA configuration module - cat > /mnt/etc/nixos/modules/system/hosts/${HOST}/nvidia.nix << 'EOF' -{ config, pkgs, lib, ... }: - -{ - # NVIDIA GPU configuration - services.xserver.videoDrivers = [ "nvidia" ]; - - hardware = { - graphics = { - enable = true; - enable32Bit = true; - }; - - nvidia = { - # Enable NVIDIA modesetting - modesetting.enable = true; - - # Use open source kernel modules (recommended for newer GPUs) - open = true; - - # Enable NVIDIA settings - nvidiaSettings = true; - - # Package configuration - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - }; - - # Environment variables for NVIDIA - environment.variables = { - WLR_NO_HARDWARE_CURSORS = "1"; - __GLX_VENDOR_LIBRARY_NAME = "nvidia"; - GBM_BACKEND = "nvidia-drm"; - }; - - # Kernel modules - boot.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; -} -EOF - - # Add NVIDIA module to host configuration - if [[ "$HOST" == "template" ]]; then - sed -i '/imports = \[/a\ nvidia-configuration' \ - "modules/system/hosts/template/default.nix" - fi -fi - -if [[ "$AMD_GPU" == true && "${ENABLE_AMD:-false}" == true ]]; then - info "Enabling AMD GPU support..." - - # Create AMD configuration module - cat > /mnt/etc/nixos/modules/system/hosts/${HOST}/amd.nix << 'EOF' -{ config, pkgs, lib, ... }: - -{ - # AMD GPU configuration - hardware = { - graphics = { - enable = true; - enable32Bit = true; - }; - - amdgpu = { - initrd.enable = true; - overdrive = { - enable = true; - ppfeaturemask = "0xffffffff"; - }; - }; - }; - - # Kernel modules - boot = { - initrd.kernelModules = [ "amdgpu" ]; - kernelModules = [ "amdgpu" "kvm-amd" ]; - }; - - # CPU microcode - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} -EOF - - # Add AMD module to host configuration - if [[ "$HOST" == "template" ]]; then - sed -i '/imports = \[/a\ amd-configuration' \ - "modules/system/hosts/template/default.nix" - fi -fi - -# Configure features -log "Configuring features..." - -if [[ "$HOST" != "usb" ]]; then - # Update feature flags in host config - cat > /mnt/etc/nixos/modules/system/hosts/${HOST}/features.nix << EOF -{ config, pkgs, lib, ... }: - -{ - # Feature flags - serenity.features = { - gaming = ${ENABLE_GAMING}; - mediaServer = ${ENABLE_MEDIA_SERVER}; - vr = ${ENABLE_VR}; - music = ${ENABLE_MUSIC}; - bluetooth = ${ENABLE_BLUETOOTH}; - }; -} -EOF -fi - -# Set initial password -log "Setting initial password..." -echo "$USERNAME:$PASSWORD" | chroot /mnt chpasswd - -# ============================================ -# 7. Install NixOS -# ============================================ - -step "Installing NixOS" - -log "This may take a while depending on your internet connection..." -log "Installing NixOS with host configuration: $HOST" - -# Install -nixos-install --flake ".#$HOST" --no-root-passwd - -# ============================================ -# 8. Post-Install Summary -# ============================================ - -step "Installation Complete!" - -echo -e "${GREEN}" -printf '%s\n' \ - "███████╗██╗ ██╗ ██████╗ ██████╗ ███████╗███████╗███████╗" \ - "██╔════╝██║ ██║██╔═══██╗██╔══██╗██╔════╝██╔════╝██╔════╝" \ - "███████╗██║ ██║██║ ██║██████╔╝█████╗ ███████╗███████╗" \ - "╚════██║██║ ██║██║ ██║██╔══██╗██╔══╝ ╚════██║╚════██║" \ - "███████║╚██████╔╝╚██████╔╝██║ ██║███████╗███████║███████║" \ - "╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝" -echo -e "${NC}" - -echo -e "${BOLD}Installation Summary:${NC}" -echo " Host: $HOST" -echo " Hostname: $HOSTNAME" -echo " Filesystem: $FILESYSTEM" -echo " Encryption: $ENCRYPT" -echo " Username: $USERNAME" -echo " Git User: $GIT_USER" -echo " Git Email: $GIT_EMAIL" -echo " Locale: $LOCALE" -echo " Timezone: $TIMEZONE" -echo "" - -if [[ "$NVIDIA_GPU" == true ]]; then - echo " NVIDIA GPU: ${ENABLE_NVIDIA:-false}" -fi -if [[ "$AMD_GPU" == true ]]; then - echo " AMD GPU: ${ENABLE_AMD:-false}" -fi -if [[ "$HOST" != "usb" ]]; then - echo " Gaming: ${ENABLE_GAMING:-false}" - echo " Media Server: ${ENABLE_MEDIA_SERVER:-false}" - echo " VR: ${ENABLE_VR:-false}" - echo " Music: ${ENABLE_MUSIC:-false}" - echo " Bluetooth: ${ENABLE_BLUETOOTH:-false}" -fi - -echo "" -echo -e "${BOLD}Next Steps:${NC}" -echo " 1. Reboot: reboot" -echo " 2. Login as: $USERNAME" -echo " 3. Change password: passwd" -echo " 4. Update: sudo nixos-rebuild switch --flake /etc/nixos#$HOST" -echo "" -echo -e "${BOLD}Customization:${NC}" -echo " - Edit files in /etc/nixos/modules/" -echo " - User config: modules/system/user.nix" -echo " - Host config: modules/system/hosts/$HOST/" -echo " - Features: modules/features/" -echo "" -echo -e "${BOLD}Useful Commands:${NC}" -echo " - Test changes: sudo nixos-rebuild test --flake /etc/nixos#$HOST" -echo " - Switch: sudo nixos-rebuild switch --flake /etc/nixos#$HOST" -echo " - Update: cd /etc/nixos && nix flake update" -echo "" - -log "Thank you for using SerenityOS!" diff --git a/modules/features/desktop/niri.nix b/modules/features/desktop/niri.nix index afb4a08..4171f7d 100644 --- a/modules/features/desktop/niri.nix +++ b/modules/features/desktop/niri.nix @@ -297,7 +297,6 @@ title = "btop"; } ]; - open-on-output = "DP-4"; open-on-workspace = "System"; open-maximized = true; } diff --git a/modules/system/core.nix b/modules/system/core.nix index 94a05fc..deae8a7 100644 --- a/modules/system/core.nix +++ b/modules/system/core.nix @@ -45,7 +45,6 @@ "rd.systemd.show_status=false" # unsure ? "rd.udev.log_level=0" # more minimising of output on boot "boot.shell_on_fail" # reboots to basic uefi shell on boot failure - "i915.fastboot=1" # unsure ? "plymouth.debug" # I NEED ANSWERS "plymouth.use-simpledrm" # tweak to allow plymouth animations to run smoother "plymouth.ignore-serial-consoles" # unsure ? @@ -84,7 +83,7 @@ # locale settings i18n = { - defaultLocale = "en_AU.UTF-8"; + defaultLocale = "en_US.UTF-8"; supportedLocales = [ "en_AU.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" diff --git a/modules/system/hosts/fractal/default.nix b/modules/system/hosts/fractal/default.nix new file mode 100644 index 0000000..4d95249 --- /dev/null +++ b/modules/system/hosts/fractal/default.nix @@ -0,0 +1,139 @@ +{ self, inputs, ... }: + +{ + + flake.nixosConfigurations.fractal = inputs.nixpkgs.lib.nixosSystem { + modules = with self.nixosModules; [ + # user and shared system modules + serenity + core + user-parts + + # machine hardware and settings + fractal-configuration + fractal-hardware + + # selected features for this desktop + network-proxy + terminal + terminal-emulator + desktop + gaming + multimedia + ]; + }; + + flake.nixosModules.fractal-configuration = + { + config, + lib, + user-parts, + ... + }: + { + networking.hostName = "fractal"; + networking.networkmanager.enable = true; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + timeout = lib.mkDefault 5; + }; + initrd.systemd.enable = true; + }; + + hardware.enableRedistributableFirmware = true; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + + # RTX 5060 Ti (Blackwell) uses NVIDIA's open kernel modules. + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + open = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + wireplumber.enable = true; + }; + + services.fstrim.enable = true; + + # Display arrangement detected on fractal: HDMI-A-1 is primary, + # with DP-2 immediately to its right. + home-manager.users.${user-parts.user.username} = { + programs.niri.settings = { + outputs = lib.mkForce { + "HDMI-A-1" = { + focus-at-startup = true; + mode = { + width = 1920; + height = 1080; + refresh = 179.98; + }; + position = { + x = 0; + y = 0; + }; + }; + "DP-2" = { + mode = { + width = 1920; + height = 1080; + refresh = 59.96; + }; + position = { + x = 1920; + y = 0; + }; + }; + }; + workspaces."01sys".open-on-output = lib.mkForce "HDMI-A-1"; + }; + + programs.noctalia.settings.bar.monitors = lib.mkForce [ + "HDMI-A-1" + "DP-2" + ]; + }; + }; + + flake.nixosModules.fractal-hardware = + { modulesPath, ... }: + { + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.supportedFilesystems = [ "btrfs" ]; + + # Add fileSystems and swapDevices here once the NixOS target layout is chosen. + }; + +} diff --git a/modules/system/hosts/template/default.nix b/modules/system/hosts/template/default.nix deleted file mode 100644 index fb919ab..0000000 --- a/modules/system/hosts/template/default.nix +++ /dev/null @@ -1,102 +0,0 @@ -{ self, inputs, ... }: - -{ - # defines the template specific configuration - # copy this directory and rename for new hosts - flake.nixosConfigurations.template = - inputs.nixpkgs.lib.nixosSystem - { - modules = with self.nixosModules; [ - # user modules - serenity # user module declaration - - # shared system modules - core # shared configuration options - user-parts # user variables - - # host-specific modules - template-configuration # host specific configuration options below - - # feature modules - terminal # most terminal programs - network-proxy # basic dns crypt proxy - - # desktop features (uncomment as needed) - # desktop # most desktop programs - # terminal-emulator # terminal program for desktops - # gaming # gaming modules, steam, osu, etc. - # media-server # remote mediashare configuration - # music # music consumption - # music-production # music creation - # multimedia # image and video programs - # virtual-reality # configuration for vr setup - # kde-connect # phone <-> desktop connectivity - ]; - }; - - # host module declaration - flake.nixosModules.template-configuration = - { pkgs, lib, ... }: - { - # set hostname - networking.hostName = "template"; - - # bootloader settings - boot = { - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - timeout = lib.mkDefault 5; - }; - initrd.systemd.enable = true; - }; - - # CPU microcode (uncomment for your CPU vendor) - # hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - # hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - - # fstrim for ssd - services.fstrim.enable = true; - - # GPU support (uncomment as needed) - # hardware.graphics.enable = true; - # hardware.graphics.enable32Bit = true; - - # NVIDIA GPU (uncomment if needed) - # services.xserver.videoDrivers = [ "nvidia" ]; - # hardware.nvidia = { - # modesetting.enable = true; - # open = true; - # nvidiaSettings = true; - # package = config.boot.kernelPackages.nvidiaPackages.stable; - # }; - # boot.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; - - # AMD GPU (uncomment if needed) - # hardware.amdgpu = { - # initrd.enable = true; - # overdrive = { - # enable = true; - # ppfeaturemask = "0xffffffff"; - # }; - # }; - # boot = { - # initrd.kernelModules = [ "amdgpu" ]; - # kernelModules = [ "amdgpu" "kvm-amd" ]; - # }; - - # Bluetooth (uncomment if needed) - # hardware.bluetooth = { - # enable = true; - # powerOnBoot = true; - # }; - - # Printing support (uncomment if needed) - # services.printing.enable = true; - - # Add host-specific packages here - environment.systemPackages = with pkgs; [ - # Add host-specific packages - ]; - }; -} diff --git a/modules/system/user.nix b/modules/system/user.nix index da85087..302d4b5 100644 --- a/modules/system/user.nix +++ b/modules/system/user.nix @@ -30,24 +30,20 @@ # configure user here nixos.user-parts = { user = { - username = "serenity"; + username = "porta"; avatar = "../../assets/media/avatars/carpet.jpg"; - home-directory = "/home/serenity/"; - default-locale = "en_AU.UTF-8"; + home-directory = "/home/porta/"; + default-locale = "en_US.UTF-8"; }; git = { - username = "serenity-F"; - email = "serenity-F@noreply.codeberg.org"; + username = "Porta"; + email = "portalmaster137@gmail.com"; }; }; # nixos user declaration users.users.${user-parts.user.username} = { - - # remember to change this - initialPassword = "password"; - # permissions management isNormalUser = true; extraGroups = [