{ config, lib, inputs, outputs, pkgs, timeZone, system, ... }:
let
  supportedDesktops = [ "sway" ];
  supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops;
  deskCfg = config.deskCfg;
in
{
  options.deskCfg = {
      de = lib.mkOption {
          default = "sway";
          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/sway/sway_conf.nix

      # inputs.nur.hmModules.nur
    ];

   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;
   
    main_user = {
      enable = true;
      userName = deskCfg.userName;
      isDesktopUser = true;
    };
    
    swaywm = {
        enable = true;
        useNonFree = true;
        installGaming = deskCfg.installGaming;
        systemPackages = with pkgs; [
          libreoffice
          rpi-imager
        ];
    };
   
    system.stateVersion = "23.11"; # Did you read the comment?
  };
}