{ config, pkgs, ... }:  

{
  ########################
  # BEGIN CUSTOM CHANGES #
  ########################

  # **********************
  # FLAKES RELATED
  # **********************
  nix = {
    package = pkgs.nixFlakes;
    extraOptions = "experimental-features = nix-command flakes";
  };


  # **********************
  # HOME-MANAGER RELATED
  # **********************
  # Currently using to manage my config files on multiple systems
  # See https://github.com/nix-community/home  -manager for manual and configuration options
  # 1) Remember to add unstable channel (in this case) in the terminal:
  #    sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
  # 2) sudo nix-channel --update
  # 3) Include "<home-manager/nixos>" in "Imports" section above
  home-manager.users.zonsopkomst = { pkgs, ... }: {
     home.packages = with pkgs; [
     # Begin packages and options
     alacritty
     ];
     # Need to enable home.stateVersion for it to work correctly:
     home.stateVersion = "22.11";
     # Begin configuration or script declarations
     home.file = {
       ".config/alacritty/alacritty.yml".text = ''
        {window: {opacity: 0.8}, font: {normal: {family: tamsyn, style: Regular}}}
       '';
     };
   };


  # **********************
  # GAMING RELATED
  # **********************

  # Enable GE-Proton (GloriousEggroll)
   environment.sessionVariables = rec {
      XDG_CACHE_HOME  = "\${HOME}/.cache";
      XDG_CONFIG_HOME = "\${HOME}/.config";
      XDG_BIN_HOME    = "\${HOME}/.local/bin";
      XDG_DATA_HOME   = "\${HOME}/.local/share";
      # Steam needs this to find Proton-GE
      STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d";
      # note: this doesn't replace PATH, it just adds this to it
      PATH = [ 
        "\${XDG_BIN_HOME}"
      ];
    };

  # Enable Gamemode
  programs.gamemode.enable = true;

  # Enable Epic Games Store in Lutris
  # TODO: This caused errors, using Flatpak until I can figure out a NixOS method
  # hardware.opengl.driSupport32Bit = true

#  # Enable Steam
#  programs.steam = {
#     enable = true;
#     remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
#     dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
#  };


  # **********************
  # LAPTOP RELATED
  # **********************
  # Laptop AMD GPU
  boot.initrd.kernelModules = [ "amdgpu" ];
  services.xserver.videoDrivers = [ "amdgpu" ];
  
  # Laptop Enable OpenCL
  hardware.opengl.extraPackages = with pkgs; [
    rocm-opencl-icd
    rocm-opencl-runtime
  ];
  
  # Laptop Enable Vulkan
  hardware.opengl.driSupport = true;


  # **********************
  # SYSTEM RELATED
  # **********************

  # Enable Insecure Packages
  nixpkgs.config.permittedInsecurePackages = [ "electron-11.5.0" ];

  # Enable Flatpak
  services.flatpak.enable = true;

  # Enable KDE Wallet PAM
  # security.pam.services.zonsopkomst.enableKwallet = true;

  # **********************
  # WEB APPLICATION RELATED
  # **********************

  # Enable the Docker Service
  # Note added "docker" group to user's extraGroups above
    virtualisation.docker.enable = true;

  services = {
      syncthing = {
          enable = true;
          user = "zonsopkomst";
          dataDir = "/home/zonsopkomst/Syncthing";    # Default folder for new synced folders
          configDir = "/home/zonsopkomst/Documents/.config/syncthing";   # Folder for Syncthing's settings and keys
      };
  };

  ######################
  # END CUSTOM CHANGES #
  ######################
}