Getting unexpected "," error in { config, pkgs, ... }:

Hi,
I’m new to NixOS and have been slowly getting into it and building up a configuration.nix over the last few days. After adding a few programs to install today I’m suddenly getting this strange error when doing a sudo nixos-rebuild switch.

error:
       … while evaluating the attribute 'config'
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: syntax error, unexpected ',', expecting '.' or '='
       at /etc/nixos/configuration.nix:5:9:
            4|
            5| { config, pkgs,  ...  }:
             |         ^
            6|

I looked at some example configs online, and plenty of them start with the same line with the comman in exactly that place. I feel like I’m missing something obvious but I just can’t figure it out.
Here is my full /etc/nixos/configuration.nix

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs,  ...  }:


let
  unstable = import <unstable> {
  	config = config.nixpkgs.config;
  };
  daisy = builtins.fetchGit {
      url = "https://github.com/rm-dr/daisy.git";
      ref = "master";
    } + /default.nix;
in {
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader = {
  	systemd-boot.enable = true;
  	efi.canTouchEfiVariables = true;
  };

  networking.hostName = "matebook"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Europe/Berlin";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_GB.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_GB.UTF-8";
    LC_IDENTIFICATION = "en_GB.UTF-8";
    LC_MEASUREMENT = "en_GB.UTF-8";
    LC_MONETARY = "en_GB.UTF-8";
    LC_NAME = "en_GB.UTF-8";
    LC_NUMERIC = "en_GB.UTF-8";
    LC_PAPER = "en_GB.UTF-8";
    LC_TELEPHONE = "en_GB.UTF-8";
    LC_TIME = "en_GB.UTF-8";
  };

  # change standard editor to micro
  environment.variables = {
  	# Environment variables go here
  	EDITOR = "micro";
  	VISUAL = "$EDITOR";
  };

  # enable (Nerd)fonts
  fonts = {
  	enableDefaultPackages = true;
  	fontconfig.enable = true;
  	packages = with pkgs; [
  	# fonts go here
  	nerdfonts
  	dina-font
  	fira-code
  	];
  };
  
  # Disable the X11 windowing system.
  services.xserver.enable = false;

  # Enable SDDM Display manager
  services.displayManager.sddm = {
  	enable = true;
  	wayland.enable = true;
  	settings.General.DisplayServer = "wayland";
  };

  # Enable the KDE Plasma Desktop Environment.
  services.desktopManager.plasma6.enable = true;
  # exclude optional packages:
  environment.plasma6.excludePackages = with pkgs; [
     # plasma-browser-integration
     konsole # default terminal emulator
     #  (lib.getBin qttools) # Expose qdbus in PATH
     ark # archiving tool
     elisa # music player
     # gwenview # image viewer
     # okular # pdf viewer
     kate # GUI text editor
     khelpcenter
     # dolphin # file explorer
     # baloo-widgets # baloo information in Dolphin
     # dolphin-plugins # e.g. mounting an iso file in dolphin
     # spectacle # capture screenshots
     # ffmpegthumbs
     # krdp #remote desktop
     # xwaylandvideobridge # exposes Wayland windows to X11 screen capture    	
  ];

  # Configure keymap in X11
  #services.xserver.xkb = {
  #  layout = "de";
  #  variant = "";
  #};

  # Configure console keymap
  console.keyMap = "de";

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable bluetooth
  hardware.bluetooth.enable = true;


  # Enable sound with pipewire.
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.knuschberkeks= {
    isNormalUser = true;
    description = "Knuschberkeks";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    #  kdePackages.kate
    #  thunderbird
    ];
  };

  # garbage collection
  nix.gc = {
      automatic = true;  # Enable the automatic garbage collector
      dates = "weekly";   # When to run the garbage collector
      options = "--delete-older-than 64d";    # Arguments to pass to nix-collect-garbage
  };
  
  
  # enable fwupd
  services.fwupd.enable = true;

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget

  #install System programs
  # programs.firefox.enable = true;
  programs = {
  	git.enable = true;
  	bash.completion.enable = true;
  };

  environment.systemPackages = with pkgs; [
  # find package names at search.nixos.org
  micro-with-wl-clipboard
  btop
  nvtopPackages.intel #(h)top like task monitor for AMD, Adreno, Intel and NVIDIA GPUs.
  eza
  bat
  fastfetch
  libreoffice
  alacritty
  stress-ng
  tealdeer
  neo-cowsay
  dmidecode
  smartmontools
  inkscape-with-extensions
  gimp-with-plugins
  youtube-dl
  kdePackages.kcalc
  kdePackages.filelight # Quickly visualize your disk space usage

  (callPackage daisy { }) # A pretty, general-purpose scientific calculator with support for units, derivatives, and more.

  ######## BROWSERS ########
  unstable.tor-browser
  unstable.librewolf
  (vivaldi.overrideAttrs # make Vivaldi work in Plasma 6
        (oldAttrs: {     # source: https://web.archive.org/web/20250322060957/https://wiki.nixos.org/wiki/Vivaldi
          dontWrapQtApps = false;
          dontPatchELF = true;
          nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [pkgs.kdePackages.wrapQtAppsHook];
        }))
  
  ######## G A M E S ########
  open-adventure
  chocolate-doom
  moon-buggy
  rogue
  brogue-ce
  nsnake
  vitetris

  ######## MEDIA ########
  mpv
  unstable.multiviewer-for-f1
  vlc 
  
  ######## MUSIC ########
  musescore
  tuxguitar
  gmetronome

  ######## SHELLS & SHELL TOOLS ########
  dash
  elvish
  checkbashisms
  ];


  # change package settings
  nixpkgs.config = {
  ##############################################
      libreoffice = {
          kdeIntegration = true;
          langs = [ # languages to install:
            "de"
          	"en-GB"
          	"en-US"
          ];
      };
   #############################################
     mpv = {
     	cddasupport = true;
     	x11support = false;
     	waylandSupport = true;
     };
   #############################################  
     vivaldi = {
     	proprietaryCodecs = true;
     	enableWidevine = true;
     };
  };
  

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "24.11"; # Did you read the comment?

}

What is nix --version?

Do you get the same thing if you run nix-instantiate --parse /etc/nixos/configuration.nix?

If so, can you double-check that what you posted is the actual, exact contents of configuration.nix, and that you didn’t forget to save in your text editor or something? This is what I would expect to see if, say, the initial # was missing in one of the first few lines.

1 Like

Oh my god, I am stupid. There was a single “a” in an extra line at the very top that I managed to miss, no idea how that got there. Thanks for your help and sorry for wasting your time.