It appears I have an elusive syntax issue

I’ve been dabbling with a NixOS VM in hopes to build a configuration that I can eventually deploy direct to hardware on my host PC. It’s a purpose built PC with the following specs.

ASUS PRIME-X570 Pro
AMD Ryzen 9 5950x
NVIDIA RTX 4090 24GB OC
128GB Corsair Vengeance RAM

Built for gaming. It’s hosted Arch Linux for the past 3 years; but the appeal of a single configuration file was too seductive to ignore and I finally caved; thus my first attempt here.

I attempted to include the output of

nixos-rebuild switch --show-trace

But it exceeds the limit when providing the appropriate information. I’ll attempt to consolidate the issue.

Error indicates unexpected comma; but I can’t seem to resolve the issue by omitting them and any attempts I’ve had at restructuring have failed.

Errors reported from --show-trace

  error: syntax error, unexpected ','

       at /etc/nixos/configuration.nix:49:36:

           48|     kernelParams = [ "nvidia-drm.modeset=1" ];  # Enables Nvidia DRM for smoother graphics
           49|     supportedFilesystems = [ "ext4", "vfat", "ntfs", "exfat" ];  # Filesystem support for various storage devices
             |                                    ^
           50|     kernel.sysctl."vm.swappiness" = 10;  # Reduces swappiness to prefer RAM over swap, beneficial for systems with ample RAM
building Nix...
error:
       … while evaluating the attribute 'config'

         at /nix/store/fnz9b0k8s5mfayxn77jximpib8n79k65-nixos-23.11.4516.e0da498ad77a/nixos/lib/modules.nix:320:9:

Raw configuration is as follows

{ config, pkgs, ... }:

{
  imports = [ ./hardware-configuration.nix ];

  # Boot and kernel configurations
  boot = {
    kernelPackages = pkgs.linuxPackages_latest; 
    kernelModules = [ "nvidia_uvm" "nvidia_modeset" "nvidia_drm" "nvidia" ];  
    initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "nvme" "sd_mod" "sr_mod" ];  
    kernelParams = [ "nvidia-drm.modeset=1" ];  
    supportedFilesystems = [ "ext4", "vfat", "ntfs", "exfat" ];  
    kernel.sysctl."vm.swappiness" = 10;  
  };

  # Hardware configurations
  hardware = {
    cpu.amd.updateMicrocode = true; 
    nvidia.package = pkgs.linuxPackages_latest.nvidiaPackages.stable; 
    pulseaudio.enable = true; t
    bluetooth.enable = true; 
    opengl.driSupport32Bit = true; 
    pulseaudio.support32Bit = true;
  };

  # Service configurations
  services = {
    # X server and display manager settings for graphical interface
    xserver = {
      enable = true;
      videoDrivers = [ "nvidia" ]; 
      displayManager.sddm.enable = true;  
      desktopManager.plasma5.enable = true; 
    };

    # Peripheral and system service configurations
    ckb-next.enable = true; 
    fail2ban.enable = true;  

    # Firewalld for flexible firewall management
    firewalld.enable = true;

    # CPU performance tuning for gaming
    cpupower = {
      enable = true;
      frequencyGovernor = "performance";  
      energyPerfBias = "performance";  
    };
  };

  # System-wide package installation
  environment.systemPackages = with pkgs; [
    amd_microcode cmake cpupower ckb-next file firefox firewalld gamemode gcc git 
    gnome-disk-utility gnote htop iptables ipset krita lutris minecraft-launcher nano 
    nmap obs-studio python3 steam telegram-desktop unzip vlc wget xsetwacom zip
  ];

  # ZRAM configuration for efficient RAM usage
  boot.zram = {
    enable = true;
    compressionAlgorithm = "lz4";
    zramSize = 16384;  # Allocates 16GB for ZRAM, utilizing a portion of the available 128GB RAM
  };

  # Network and localization settings
  networking = {
    hostName = "THERAK";  
    networkmanager.enable = true; 
  };
  time.timeZone = "Europe/Berlin"; 
  i18n.defaultLocale = "en_US.UTF-8"; 
  security.sudo.enable = true; 

  # User configuration
  users.users.yourUsername = {
    isNormalUser = true;
    extraGroups = [ "wheel" ]; 
  };

  # Font configuration for improved aesthetics and readability
  fonts.fonts = with pkgs; [
    noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra dejavu_fonts  
  ];
}

Regards,
AO

P.S. Happy to provide full report of $ nixos-rebuild switch --show-trace in a separate post if needed. I appreciate your time.

Lists aren’t comma delimited

3 Likes

You appear to have a stray letter “t” following your pulseaudio statement:

pulseaudio.enable = true; t

But if/how that relates to the comma error, I don’t know.

2 Likes

I spent the day studying NixOS configuration and managed to get everything squared away. This was the outcome.

Full Nvidia X11 support with RTX features enabled.
OBS_studio and some choice apps.
Wacom Tablet support for my Cintique
Switched to Pipewire due to some strange static issues that couldn’t be resolved with the commonly recommended fixes.
As well as some common system services and configurations.
I’ll work on it some more tomorrow; but for now, she’s stable and capable of doing pretty much whatever I wanted out of it.

The only known issue that I have right now is with protonvpn-cli as while it installed well, and I can attempt to login; iI get an “unknown API” error upon login attempts.

{ config, pkgs, ... }:

{
  imports = [                                 # Import hardware specific configurations
    ./hardware-configuration.nix
  ];

  nixpkgs.config.allowUnfree = true;          # Allow the installation of unfree packages like Nvidia drivers

  system.stateVersion = "23.11";              # Set to your NixOS version

  boot.loader.systemd-boot.enable = true;     # Enable systemd-boot instead of GRUB
  boot.kernelPackages = pkgs.linuxPackages_latest;  # Use the latest stable kernel
  boot.kernelModules = [ "nvidia_uvm" "nvidia_modeset" "nvidia_drm" "nvidia" "wacom" "wacom_w8001" ];  # Load these kernel modules at boot
  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "nvme" "sd_mod" "sr_mod" ];  # Specify kernel modules in the initial RAM disk
  boot.kernelParams = [ "nvidia-drm.modeset=1" ];   # Additional kernel parameters
  boot.supportedFilesystems = [ "ext4" "vfat" "ntfs" "exfat" ];  # Filesystems supported by the boot loader
  boot.kernel.sysctl."vm.swappiness" = 10;   # Reduce swappiness to prioritize physical memory over swap

  hardware.cpu.amd.updateMicrocode = true;   # Update AMD CPU microcode for security
  hardware.nvidia.package = pkgs.linuxPackages_latest.nvidiaPackages.stable;  # Specify the Nvidia driver package
  hardware.bluetooth.enable = true;          # Enable Bluetooth support
  hardware.opengl.driSupport32Bit = true;    # Enable 32-bit DRI support for OpenGL

  services.pipewire = {
    enable = true;                           # Enable PipeWire as the multimedia framework
    alsa.enable = true;                      # Enable ALSA support in PipeWire
    alsa.support32Bit = true;                # Enable 32-bit ALSA support
    pulse.enable = true;                     # Enable PulseAudio support in PipeWire
    jack.enable = true;                      # Enable JACK support in PipeWire
  };

  services.xserver = {
    enable = true;                           # Enable the X Server
    videoDrivers = [ "nvidia" ];             # Use the Nvidia driver
    displayManager.sddm.enable = true;       # Enable SDDM display manager
    desktopManager.plasma5.enable = true;    # Enable the Plasma 5 desktop
    wacom.enable = true;                     # Enable Wacom tablet support
  };

  services.fail2ban.enable = true;           # Enable fail2ban to ban IPs that show malicious signs

  networking.firewall.enable = true;         # Enable the firewall

  environment.systemPackages = with pkgs; [  # Define system-wide packages to install
    asciiquarium-transparent beebeep cmake cmatrix dconf file firefox gamemode gcc git gnome.gnome-disk-utility gnote htop iptables ipset
    jellyfin-media-player krita linuxPackages_zen.cpupower lm_sensors lutris mangohud microcodeAmd
    minecraft nano neofetch nmap obs-studio protonup-qt protonvpn-cli python3 steam telegram-desktop tilix unzip
    vlc vscode-with-extensions wacomtablet wget zip
  ];

  networking.hostName = "nunyah";            # Set the system's hostname
  networking.networkmanager.enable = true;   # Enable NetworkManager for network configuration

  time.timeZone = "America/Chicago";         # Set the system time zone
  i18n.defaultLocale = "en_US.UTF-8";        # Set the system locale

  security.sudo = {
    enable = true;                           # Enable sudo
    configFile = ''                          # Configure sudoers for 'wheel' group
      root ALL=(ALL:ALL) ALL
      %wheel ALL=(ALL:ALL) ALL
    '';
  };

  users.users.obeisance = {
    isNormalUser = true;                     # Indicate this is a normal user account
    extraGroups = [ "wheel" ];               # Add user to 'wheel' group for sudo access
    shell = pkgs.zsh;                        # Set Zsh as the default shell for this user
  };

  programs.zsh.enable = true;                # Enable Zsh for the system

  fonts.packages = with pkgs; [              # Font configuration
    noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra dejavu_fonts
  ];