{ config, pkgs, ... }:

{
  imports =
    [ 
      ./hardware-configuration.nix
    ];

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  boot.kernelPackages = pkgs.linuxPackages_6_1;

  boot.initrd.luks.devices."luks-62a9c28b-959c-480e-bf53-e87b791b569d".device = "/dev/disk/by-uuid/62a9c28b-959c-480e-bf53-e87b791b569d";
  networking.hostName = "core";
  networking.enableIPv6 = false;

  networking.networkmanager.enable = true;

  time.timeZone = "Asia/Tehran";

  i18n.defaultLocale = "en_US.UTF-8";

  services.xserver.enable = true;

  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;

  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

  #graphics drivers
  services.xserver.videoDrivers = [
    "modesetting"
    "nvidia"
  ];

  hardware.graphics = {
    enable = true;
  };

  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    open = false;
    nvidiaSettings = true;
  };

  services.printing.enable = false;

  services.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };

  security = {
    sudo.enable = false;
    doas.enable = true;
    doas.extraRules = [
      {
        users = [ "coast" ];
        keepEnv = true;
        persist = true;
      }
    ]; 
  };

  users.users.coast = {
    isNormalUser = true;
    description = "coast";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      kdePackages.kate
      vesktop
      fastfetch
      chromium
      tor-browser
      unrar
      git
      htop
      nix-search-cli
      vscode
    ];
  };

  services.flatpak.enable = true;

  programs = {
    nekoray = {
      enable = true;
      tunMode.enable = true;
    };
    steam.enable = true;
  };

  nixpkgs.config.allowUnfree = true;

  environment.systemPackages = with pkgs; [
    wget
    vim
    lshw
    alsa-utils
    wine
    winetricks
    wineWowPackages.stable
    wine64
    wineWowPackages.waylandFull
  ];

  system.stateVersion = "25.05";

}
