{ config, lib, inputs, outputs, pkgs, timeZone, system, ... }:
let
  supportedDesktops = [ "kde" ];
  supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops;
  deskCfg = config.deskCfg;
in
{
  options.deskCfg = {
      de = lib.mkOption {
          default = "kde";
          type = lib.types.str;
          description = "Desktop Environment";
      };
      userName = lib.mkOption {
          type = lib.types.str;
          description = "Main username for system";
      };
      hostName = lib.mkOption {
          type = lib.types.str;
          description = "Hostname for system";
      };
      installGaming = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Whether to install gaming software or not";
      };
  };

   imports = [
     modules/user/main_user.nix
     modules/labwc/labwc_conf.nix
   ];

   config = {
    assertions = [
      {
        assertion = builtins.elem deskCfg.de supportedDesktops;
        message = "Unsupported desktop environment: ${deskCfg.de}\nSupported DE's: ${supportedDesktopsStr}";
      }
    ];

    nixpkgs.overlays = [
      inputs.nur.overlay
    ];

    # Enable flakes feature
    nix.settings.experimental-features = [
      "nix-command" "flakes"
    ];

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

    networking.hostName = deskCfg.hostName; # Define your hostname.
    networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.

    time.timeZone = timeZone;


    users.users.${deskCfg.userName} = {
        isNormalUser = true;
        initialPassword = "password";
        description = "main user";
        shell = pkgs.zsh;
        extraGroups = [
            "wheel"
            "networkmanager"
            "corectrl"
            deskCfg.userName
            "video"
            "audio"
        ];
    };
       # main_user = {
    #   enable = true;
    #   userName = deskCfg.userName;
    #   isDesktopUser = true;
    # };
    
    labwc = {
        enable = true;
        useNonFree = true;
        installGaming = deskCfg.installGaming;
        systemPackages = with pkgs; [
          libreoffice
        ];
    };
   
    system.stateVersion = "23.11"; # Did you read the comment?
  };
}