I'm having some trouble using sudo nixos-rebuild switch --flake /etc/nixos#default

My configuration.nix

{ config, pkgs, … }:

{

imports = [ ./hardware-configuration.nix

          ];
          
hardware = { pulseaudio.enable = false; # PulseAudio sound server for Linux
            
          }


# Bootloader, Networking, TimeZone, Users

boot.loader = { grub.enable = true;
                grub.device = "/dev/sda";
                grub.useOSProber = true;
              
              };

networking = { hostName = "nixos";
               wireless.enable = true;  # Enables wireless support via wpa_supplicant.
               networkmanager.enable = true;
               #firewall.enable = false;
               #firewall.allowedTCPPorts = [ ... ];
               #firewall.allowedUDPPorts = [ ... ];
              
             };

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

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

# Services

security.rtkit.enable = true;

services = { xserver.enable = true;  # Enable X11 windowing system.
             printing.enable = true; # Enable CUPS to print documents.
             openssh.enable = true;  # Enable the OpenSSH daemon.
             pipewire.enable = true; # Enable sound with pipewire.
            
          };

services.xserver = { displayManager.lightdm.enable = true; 
                     desktopManager.xfce.enable = true;
                    
                     # Configure keymap in X11
                     layout = "us";
                     xkbVariant = "";

                     libinput.enable = true; # Enable touchpad support

                  };

services.pipewire = { alsa.enable = true;
                      alsa.support32Bit = true;
                      pulse.enable = true;

                    };
# Programs

programs = { gnupg.agent.enable = false;
             gnupg.agent.enableSSHSupport = false;

             mtr.enable = false; # Enable CUPS to print documents.

           };

# Users. Don't forget to set a password with ‘passwd’.
users.users.user = { isNormalUser = true;
                    description = "user";
                    extraGroups = [ "networkmanager" "wheel" ];
                    packages = with pkgs; [];

                  };

# Packages

nixpkgs.config.allowUnfree = true;  
nix.settings.experimental-features = ["nix-command" "flakes"];

# Environment System Packages
environment = { systemPackages = with pkgs; [ vim
                                              wget
                                              ungoogled-chromium
                                              lf
                                              vscodium
                                            ];
              };

system = { stateVersion = "23.11"; }

}

After I use the command:

sudo nixos-rebuild switch --flake /etc/nixos#default

I get this error:

error:
… while calling the ‘seq’ builtin

     at /nix/store/370qy3d3wg9zhbn5a3dcv6k1q1iigfh4-source/lib/modules.nix:322:18:

      321|         options = checked options;
      322|         config = checked (removeAttrs config [ "_module" ]);
         |                  ^
      323|         _module = checked (config._module);

   … while evaluating a branch condition

     at /nix/store/370qy3d3wg9zhbn5a3dcv6k1q1iigfh4-source/lib/modules.nix:261:9:

      260|       checkUnmatched =
      261|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
         |         ^
      262|           let

   (stack trace truncated; use '--show-trace' to show the full trace)

   error: syntax error, unexpected '=', expecting ';'

   at /nix/store/xw7l0dzw1ffqmci5p6vldyjdjzkwnpv3-source/configuration.nix:19:17:

       18|
       19|     boot.loader = {
         |                 ^
       20|                     grub.enable = true;

Is there anything I should learn on how to make posts on this forum ? Btw, I tried chatGPT and the docs, and it all seemed fine to me, they had the same example even. I really don’t know what to do anymore. Also, I’m new to NixOS.

You’re missing a semicolon here, i.e.:

hardware = { pulseaudio.enable = false; # PulseAudio sound server for Linux
            
          };

Nothing in particular, people are largely quite friendly, albeit perhaps a bit overly enthusiastic about NixOS.

Your formatting is at least still vaguely readable because your indentation happens to match, but it’s definitely helpful to at least learn basic markdown formatting for code blocks: Creating and highlighting code blocks - GitHub Docs

There’s a preview button in the discourse post editor you can use if you experiment with this.

If you don’t format your code correctly people won’t reply as much on account of not being able to reasonably read your code - we’re all just volunteers chatting about something we’re passionate about, and trying to read poorly formatted posts just isn’t fun.

1 Like

Thank you, very much! I’m also overly enthusiastic about NixOS, so I understand, thank you for the introdcution!