A comprehensive, modular NixOS configu- Hyprlock Lockscreenation with Nix flakes, featuring Hyprland window manager, advanced power management, and automated scripts for a seamless desktop experience.
โโโ configuration.nix # Main configuration file
โโโ flake.nix # Flake configuration
โโโ hardware-configuration.nix # Hardware-specific settings (auto-generated)
โโโ modules/
โโโ core/
โ โโโ boot.nix # Bootloader settings (systemd-boot)
โ โโโ default.nix # Imports for core modules
โ โโโ hardware.nix # Hardware & firmware configs (kernel, firmware, udev rules)
โ โโโ nix.nix # Nix settings, GC, unfree
โโโ desktop/
โ โโโ deepin.nix # Deepin desktop environment (disabled)
โ โโโ default.nix # Imports for desktop modules
โ โโโ hyprland.nix # Hyprland window manager with Wayland ecosystem
โโโ fonts/
โ โโโ hsr-zh-cn.ttf # Custom font
โโโ home/
โ โโโ jc.nix # Home Manager: user packages, programs & dotfiles
โ โโโ .config/ # Application dotfiles (Hyprland, Waybar, etc.)
โ โโโ scripts/ # Modular Nix scripts (power management, UI, etc.)
โ โโโ apply-home-manager.nix # Home Manager apply with notifications
โ โโโ brightness-control.nix # Brightness control with notifications
โ โโโ graceful-shutdown.nix # Smart shutdown/reboot handler
โ โโโ lock-screen.nix # Multi-locker selection menu
โ โโโ lxc-gui.nix # LXC container GUI manager
โ โโโ volume-control.nix # Volume control with notifications
โโโ programs/
โ โโโ cli.nix # Command-line interface tools
โ โโโ default.nix # Imports for program modules
โ โโโ development.nix # Development tools + TLP power management
โ โโโ fonts.nix # Font configurations
โโโ services/
โ โโโ audio.nix # PipeWire audio configuration
โ โโโ channels.nix # Nix channels configuration
โ โโโ default.nix # Imports for service modules
โ โโโ network.nix # Hostname, NetworkManager, firewall
โ โโโ virtualization.nix # LXD + nix-ld (FHS compat)
โโโ settings/
โ โโโ default.nix # Imports for settings modules
โ โโโ journald.nix # Journald configuration
โ โโโ locale.nix # Timezone & localization + Fcitx5
โ โโโ memory.nix # Swap & zram
โ โโโ plymouth.nix # Plymouth boot theme
โโโ users/
โโโ jc.nix # User account & groups
- Modular Design: Clean separation of concerns with Nix flakes
- Home Manager Integration: User-level packages and configurations
- Advanced Power Management: TLP + thermald replacing auto-cpufreq
- Containerization: LXD with GUI management and application mirroring
- Hyprland: Modern Wayland compositor with smooth animations
- Waybar: Customizable status bar with gradients and visual feedback
- Dual Lock Screens: Hyprlock (native Hyprland lock screen)
- Smart Notifications: Swaynotificationcenter with fallback support
- Lock Screen: Hyprlock integration for Hyprland
- Graceful Shutdown: Intelligent application closure with user prompts
- Custom Scripts: Modular Nix-based scripts for system management
- Home Manager Automation: One-command configuration updates with notifications
- Window Manager: Hyprland with Waybar status bar
- Terminals: Kitty (primary), with Cascadia Code Nerd Font
- File Management: Thunar with volume management and trash support
- Media: VLC, gThumb image viewer
- Screenshots: Flameshot + grim for versatile capture options
- Editors: VS Code, configured for optimal performance
- Languages: Python 3.13, Node.js, Java (OpenJDK)
- Version Control: Git with SSH agent
- Package Management: uv for Python virtual environments
- Productivity: OnlyOffice Desktop Editors
- AI Tools: Gemini CLI, ani-cli for media streaming
- Power Management: TLP with intelligent AC/battery profiles, thermald for thermal control
- Monitoring: Mission Center, nvtop for NVIDIA GPUs
- Virtualization: LXD with custom GUI manager and desktop app mirroring
- Shell: Zsh with Starship prompt
- Input: Fcitx5 for multi-language input support
- Kernel: Linux stable with all redistributable firmware
- Display: 1920x1080@144Hz with 1x scaling, optimized for laptops
- Audio: PipeWire with ALSA/PulseAudio compatibility
- Graphics: NVIDIA support with PRIME configuration options
- TLP Configuration: Optimized for laptop usage
- Performance mode on AC power
- Power-saving mode on battery (20% max CPU)
- Battery health protection (40-80% charging thresholds)
- Thermal Management: thermald for Intel CPU thermal control
- Memory: 4GB swapfile + 30% zram with LZ4 compression
- Volume Control: WirePlumber integration with visual notifications
- Brightness Control: Step-based adjustment with percentage display
- Lock Screen Menu: Dynamic selection between lock screen options
- Graceful Shutdown: Smart application management before system shutdown
- Home Manager Updates: Automated configuration application with status notifications
- Hostname: JakeClark-Sep21st
- Network Management: NetworkManager with firewall enabled
- SSH: Client-side SSH agent enabled (server disabled by default)
- Virtualization: LXD for container management with GUI interface
-
Clone Repository:
git clone https://github.com/JakeClark38a/my-nixos-config.git cd my-nixos-config
-
Prepare Hardware Configuration:
sudo cp /etc/nixos/hardware-configuration.nix .
-
Test Configuration:
sudo nixos-rebuild test --flake .
-
Apply Configuration:
sudo nixos-rebuild switch --flake .
- Home Manager Setup: Automatically configured via flake integration
- Custom Scripts: Available immediately in PATH (lock-screen, volume-control, etc.)
- LXC Containers: Access via
lxc-gui
command or application menu
# Update flake inputs and rebuild
sudo nix flake update
sudo nixos-rebuild switch --flake .
# One-liner update
sudo nixos-rebuild switch --recreate-lock-file --flake .
# Apply Home Manager changes (with notifications)
apply-home-manager
# Or manually
home-manager switch --flake .
# Test configuration without switching
sudo nixos-rebuild test --flake .
# Build without applying
sudo nixos-rebuild build --flake .
# View generations
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
# Rollback to previous generation
sudo nixos-rebuild switch --rollback
- System-wide: Edit relevant module in
modules/programs/
- User-specific: Add to
home.packages
inmodules/home/jc.nix
- Development tools: Modify
modules/programs/development.nix
- Create new script: Add to
modules/home/scripts/script-name.nix
- Import in Home Manager: Add import to
modules/home/jc.nix
let section - Include in packages: Add script variable to
home.packages
- Hyprland config: Edit
modules/home/.config/hypr/hyprland.conf
- Waybar styling: Modify
modules/home/.config/waybar/style.css
- Lock screens: Configure via Home Manager in
jc.nix
- TLP settings: Adjust in
modules/programs/development.nix
- Battery thresholds: Modify charge limits for battery health
- Performance profiles: Customize AC vs battery behavior
Super + Enter
: Open terminalSuper + D
: Application launcherSuper + L
: Lock screen (default Hyprlock)Super + Shift + L
: Lock screen menu (choose locker)Super + E
: File managerSuper + Shift + Q
: Close window
Super + Shift + H
: Apply Home Manager configurationCtrl + Alt + Delete
: Graceful shutdownCtrl + Alt + R
: Graceful rebootXF86 Keys
: Volume/brightness with notifications
lock-screen [hyprlock|menu]
: Lock screen optionsgraceful-shutdown [shutdown|reboot]
: Smart system shutdownvolume-control [up|down|mute]
: Audio control with notificationsbrightness-control [up|down]
: Display brightness with notificationsapply-home-manager
: Update Home Manager with notificationslxc-gui
: LXC container management interface
- Separated inline scripts: Moved all shell scripts to individual
.nix
files - Better maintainability: Each script in
modules/home/scripts/
for easier editing - Cleaner configuration: Reduced main
jc.nix
file complexity by 250+ lines
- Replaced auto-cpufreq: Switched to native TLP + thermald solution
- Battery health protection: Automatic 40-80% charging threshold management
- Performance optimization: Intelligent AC vs battery power profiles
- Lock screen support: Hyprlock via Home Manager
- Interactive selection: Menu-driven lock screen choice with Wofi integration
- Home Manager integration: Native configuration management for both lockers
- Audio problems: Check PipeWire status with
wpctl status
- Display scaling: Verify Hyprland monitor configuration in
hyprland.conf
- Script permissions: Ensure scripts are executable via Home Manager rebuild
# System logs
journalctl -f
# Home Manager logs
home-manager switch --flake . --verbose
# Hyprland logs
journalctl --user -f -u hyprland
- Target NixOS Version: 25.05 (stable channel)
- Package Manager: Nix with flakes enabled
- Window Manager: Hyprland on Wayland
- Theme: Adwaita with custom Waybar styling
- Locale: Vietnamese with US keyboard layout
This configuration serves as a comprehensive example of modern NixOS setup. Feel free to:
- Fork and adapt for your hardware/preferences
- Submit improvements via pull requests
- Report issues or suggest enhancements
- Use as a learning resource for NixOS/Home Manager
This configuration is provided as-is for educational and personal use. Individual software components retain their respective licenses.