Update Build Config Error

Hi guys. I am here again. Although your prior suggestions have worked here - BTW Thanks - Now, Adding a user based configuration, I am finding a new problem.

The error is:

[root@T101:/home/walter]# sudo nixos-rebuild switch --show-trace 
building Nix...
building the system configuration...
error: while evaluating the attribute 'config.system.build.toplevel' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:274:5:
while evaluating 'foldr' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:52:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:138:12:
while evaluating 'fold'' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:55:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:59:8:
while evaluating the attribute 'assertions' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `assertions':
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:415:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:500:14:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:500:14:
while evaluating the attribute 'enable' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `services.openssh.enable':
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:415:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:500:14:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:500:14:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:500:14:
while evaluating the attribute 'condition' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:500:14:
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:340:22:
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:456:7:
while evaluating 'byName' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:217:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:233:22:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:218:22, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:218:9:
value is a boolean while a set was expected, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:219:25

My 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, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      # Enable the KDE Desktop Environment.
      ./kde-configuration.nix
      ./local-configuration.nix##user.wjjunyor
    ];

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;

  # Uses the most recent packages.
  boot.kernelPackages = pkgs.linuxPackages_latest;

  # Supposedly better for the SSD.
  fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  boot.loader.grub.device = "nodev";
  boot.loader.grub.efiSupport = true;
  boot.loader.efi.canTouchEfiVariables = true;
  # Grub menu is painted really slowly on HiDPI, so we lower the
  # resolution. Unfortunately, scaling to 1280x720 (keeping aspect
  # ratio) doesn't seem to work, so we just pick another low one.
  boot.loader.grub.gfxmodeEfi = "1024x768";
  boot.loader.grub.enableCryptodisk = true;
  boot.initrd.luks.devices = {
    "root" = {
    device = "/dev/disk/by-uuid/d83054a8-ef44-4e19-99a9-d498ba6a6d62";
    preLVM = true;
    allowDiscards = true;
    };
  };

  # Networking set-up
  networking.hostName = "T101"; # Define your hostname.
  networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
  networking.nameservers = [ "84.200.69.80" "84.200.70.40" ]; # DNS Watch
  
  # Wi-fi corporate network set-up
  networking.wireless.networks = {
    "walCOR Seguros" = {         # SSID with spaces and/or special characters
    pskRaw = "----------------------";
    };
  };

  # The global useDHCP flag is deprecated, therefore explicitly set to false here.
  # Per-interface useDHCP will be mandatory in the future, so this generated config
  # replicates the default behaviour.
  networking.useDHCP = false;
  networking.interfaces.enp1s0.useDHCP = true;
  networking.interfaces.wlp2s0.useDHCP = true;

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

  # Select internationalisation properties.
  i18n.consoleFont = "Lat2-Terminus16";
  i18n.consoleKeyMap = "br-abnt2";
  i18n.defaultLocale = "pt_BR.UTF-8";
  
  # Set your time zone.
  time.timeZone = "America/Campo_Grande";

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  # environment.systemPackages = with pkgs; [
  #   wget vim
  # ];

  # 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;

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

  # Enable sound.
  sound.enable = true;
  hardware.pulseaudio.enable = true;

  # Loads GPU drivers on T-101 station.
  nixpkgs.config.allowUnfree = true;
  services.xserver.videoDrivers = [ "intel" "amdgpu" ];

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable touchpad support.
  services.xserver.libinput.enable = true;

  # 32 bit Open GL support.
   hardware.opengl.driSupport32Bit = true;

  # Fonts Settings.
  fonts.enableFontDir = true;
  fonts.enableGhostscriptFonts = true;
  fonts.fonts = [ pkgs.inconsolata pkgs.unifont pkgs.font-awesome-ttf pkgs.source-code-pro  pkgs.freefont_ttf pkgs.opensans-ttf pkgs.liberation_ttf pkgs.liberationsansnarrow pkgs.ttf_bitstream_vera pkgs.libertine pkgs.ubuntu_font_family pkgs.gentium pkgs.symbola ];

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.wjjunyor = {
    isNormalUser = true;
    extraGroups = [ "wheel" "disk" "audio" "video" "networkmanager" "systemd-journal" ]; # Enable ‘sudo’ for the user.
    home = "/home/wjjunyor";
    description = "Walter Queiroz";
    uid = 1000;
  };

  # This value determines the NixOS release with which your system is to be
  # compatible, in order to avoid breaking some software such as database
  # servers. You should change this only after NixOS release notes say you
  # should.
  system.stateVersion = "19.09"; # Did you read the comment?
  
  # Auto upgrade Always ON.
  system.autoUpgrade.enable = true;

  # Enable Tor Browser as Service - Security Reasons.
  services.tor.enable = true;
  services.tor.client.enable = true;
  
  # Enable SmarCard Daemon.
  services.pcscd.enable = true;
  services.pcscd.plugins = [ pkgs.pcsclite pkgs.opensc pkgs.openssl pkgs.pcsctools pkgs.libusb pkgs.ccid pkgs.pcsc-cyberjack ];
  
  # Fundamental core packages
  environment.systemPackages = with pkgs; [
    # Basic command line tools
    bash
    wget
    file
    gksu
    git
    hdf5
    zip
    unzip
    htop
    yle-dl
    youtube-dl
    nix-index
    dnsutils
    whois
    coreutils
    vbetool
    killall
    nethogs
    # Gamin: a file and directory monitoring system
    fam
    # Basic image manipulation and handling stuff
    imagemagick
    ghostscript
    # Text editors
    vim
    xclip  # system clipboard support for vim
    # VPN
    pptp
    openvpn
    # File format conversions
    pandoc
    pdf2svg
    # Screen brightness and temperature
    redshift
    # SSH filesystem
    sshfsFuse
    # Encryption key management
    gnupg
    # Yet another dotfile manager
    yadm
    gnupg1orig
    # Password hash generator
    mkpasswd
    # Android
    jmtpfs
    gphoto2
    libmtp
    mtpfs
    nix-prefetch-git
    # Make NTFS filesystems (e.g., USB drives)
    ntfs3g
    # Encrypted USB sticks etc
    cryptsetup
    # GPG password entry from the terminal
    pinentry
    # GUI for sound control
    pavucontrol
    python3Packages.magic-wormhole
    ];
}

The imported files in sequence are kde-configuration.nix e local-configuration.nix - I know the problem is in the local-configuration.nix because the but only with the kde-configuration.nix is OK .

This is kde-configuration.nix:

{ pkgs, ... }: {

  #Open ports for KDE Connect
   networking.firewall.allowedTCPPortRanges = [ { from = 1714; to = 1764; } ];
   networking.firewall.allowedUDPPortRanges = [ { from = 1717; to = 1764; } ];
  

  # Use Plasma 5
   services.xserver.desktopManager.plasma5.enable = true;
   services.xserver.desktopManager.default = "plasma5";  #Deprecated
   #services.xserver.displayManager.defaultSession = "plasma5";
   services.xserver.layout = "br";
   services.xserver.xkbVariant = "abnt2";
  

  # User packages for graphic environment.
   environment.systemPackages = with pkgs;
    [ kdeFrameworks.kwallet # Password manager for KDE
      kdeApplications.kwalletmanager
      kwalletcli
      # Allow automatic unlocking of kwallet if the same password. This seems to
      # work without installing kwallet-pam.
      kwallet-pam
      # ssh-add prompts a user for a passphrase using KDE. Not sure if it is used
      # by anything? ssh-add just asks passphrase on the console.
      #ksshaskpass
      # Archives (e.g., tar.gz and zip)
      ark
      # GPG manager for KDE
      kgpg
      # This is needed for graphical dialogs used to enter GPG passphrases
      pinentry
      kdeplasma-addons
      # Screenshots
      kdeApplications.spectacle
      # Bluetooth
      bluedevil
      # Text editor
      kate
      # Drop-down terminal
      yakuake
      # Printing and scanning
      kdeApplications.print-manager
      simple-scan
      # Document readers
      okular
      # Browsers
      firefox
      chromium
      # Email
      #kmail
      thunderbird
      # Office suit
      libreoffice
      # Photo/image editor
      gwenview
      digikam5
      # Media player
      vlc
      # KDE apps
      kdeFrameworks.kconfig
      kdeFrameworks.kconfigwidgets
      kdeFrameworks.kio
      plasma-browser-integration
      konsole
      dolphin
      kdeApplications.dolphin-plugins
      kdeApplications.kio-extras
      kdeApplications.knotes
    ];
  }

And this is the local-configuration.nix:

{ config, lib, options, modulesPath, users, pkgs }:
{
  # hostName = "t101";
  # nixpkgs = "/etc/nixpkgs";
  # grubDevice = "/dev/sda";
  users = with users; [
    (wjjunyor { groups = [ "wheel" "adbusers" ]; })
  ];
  # displayManager = "sddm";
  # desktopEnvironment = "plasm5";
  services = {
    sshd = false;
    emacs = false;
    # bluetooth = {
    #   enable = true;      # Estudar esta parada pois quero BT em meu note 
    # };
    # mailserver = {
    #   enable = false;
    # };
    # mythbackend = true;
    # mythfrontend = true;
    # storj = true;
    # bluray = true;
    # https://github.com/jluttine/CryptOS
    # cryptos = {
    #   enable = false;
    # };
    # https://syncthing.net/
    # syncthing = {
    #   enable = false;
    #   user = "wjjunyor";
    # };
  };
  programs = {
    adb = true;
  };
  environment.systemPackages = with pkgs;
   [ # LaTeX https://en.wikipedia.org/wiki/TeX
     # texlive.combined.scheme-full
     # OpenStreetMap editor
     josm.aarch64-linux
     # 3D modelling
     # blender
     # Zotero client
     #qnotero
     encfs
     # E-books
     fbreader
     calibre
     # RSS reader
     #feedreader
     rssguard
     # Disk usage analysis
     filelight
     qdirstat
     w_scan
     # Photo manager
     shotwell
     # Audio editor
     audacity
     # MPD client
     cantata
     # Panorama stitcher (with raw support)
     hugin
     #dcraw # marked as insecure
     # HDR photography
     luminanceHDR
     #  Photo/Image Editor
     gimp-with-plugins
     # Vector Editor 
     inkscape
     # Torrenting
     ktorrent
     # Browser
     tor-arm.x86_64-linux
     # Instant messaging
     #cutegram
     tdesktop
     qtox
     linphone
     pybitmessage
     riot-web
     # Twitter
     corebird
     # Torrenting
     ktorrent
     # Encryption
     openssl
     # Tool for searching files/binaries from Nix packages
     nix-index
     # Programming
     # emacs
     # gitAndTools.gitflow
     # pgadmin
     # gitAndTools.hub
     # direnv
     # Password manager
     pass
     # Separate tiling window manager
     #i3
     patchelf
     # Mobile SSH replacement
     mosh
     k3b
     dvdplusrwtools
     (python3.withPackages (ps: with ps; [
       numpy
       scipy
       # Python language server for Emacs
       #python-language-server
   ]))
 ];
}