# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.

#---------------------------------------------------------------------
# Imports and basic configuration
#---------------------------------------------------------------------
{ config, lib, pkgs, modulesPath, ... }:

{
  #---------------------------------------------------------------------
  # Module imports
  #---------------------------------------------------------------------
  imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];

  #---------------------------------------------------------------------
  # Boot configuration
  #---------------------------------------------------------------------
  boot = {
    blacklistedKernelModules = lib.mkDefault [ "nouveau" ];
    extraModulePackages = [ ];
    initrd.kernelModules = [ "amd" ];

    kernelModules = [

      "amd"
      "amdgpu"
      "kvm-intel"
      "amd-pstate"
      "kvm-amd"
    ];

    # Boot - Plymouth
    # https://search.nixos.org/options?channel=unstable&show=boot.plymouth.enable
    plymouth.enable = true;
    plymouth.theme = "breeze";

    # kernelPackages = pkgs.linuxPackages_latest;

    kernelParams = [

      "amd_pstate=active"
      "amdgpu.exp_hw_support=1" # Enable experimental hardware support
      "amdgpu.ppfeaturemask=0xffffffff" # Enable all power features
      "mitigations=off"
      "quiet"
      "udev.log_level=3"
      "video=DP-1:1920x1080@60"

    ];

    initrd.availableKernelModules = [

      "ahci"
      "ehci_pci"
      "sd_mod"
      "sr_mod"
      "usb_storage"
      "usbhid"
      "xhci_pci"
      "uas"
    ];

  };

  #---------------------------------------------------------------------
  # File system configurations
  #---------------------------------------------------------------------
  fileSystems."/" = {
    device = "/dev/disk/by-uuid/182227dd-396d-4db3-886d-3ae856ec7a11";
    fsType = "ext4";

    # Optimize SSD
    options = [

      "data=ordered"
      "discard"
      "errors=remount-ro"
      "noatime"
      "nodiratime"

    ];
  };

  fileSystems."/boot" = {
    device = "/dev/disk/by-uuid/81CF-3263";
    fsType = "vfat";
  };

  swapDevices =
    [{ device = "/dev/disk/by-uuid/cfe6ad60-b461-4bb0-8ffd-c1a17cab6699"; }];

  #---------------------------------------------------------------------
  # Mounting options for samba
  #---------------------------------------------------------------------
  fileSystems."/mnt/sambashare" =

    {
      device = "//192.168.0.20/LinuxData/HOME/PROFILES/NIXOS-23-05/TOLGA/";
      fsType = "cifs";
      options = let
        automountOpts =
          "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,x-systemd.requires=network.target";
        uid =
          "1000"; # Replace with your actual user ID, use `id -u <YOUR USERNAME>` to get your user ID
        gid =
          "100"; # Replace with your actual group ID, use `id -g <YOUR USERNAME>` to get your group ID
        vers = "3.1.1";
        cacheOpts = "cache=loose";
        credentialsPath = "/etc/nixos/core/system/network/smb-secrets";
      in [
        "${automountOpts},credentials=${credentialsPath},uid=${uid},gid=${gid},vers=${vers},${cacheOpts}"
      ];

    };

  #---------------------------------------------------------------------
  # For AMD hardware / chipsets
  #---------------------------------------------------------------------
  # hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

  #---------------------------------------------------------------------
  # For Intel hardware / chipsets
  #---------------------------------------------------------------------
  hardware.cpu.intel.updateMicrocode =
    lib.mkDefault config.hardware.enableRedistributableFirmware;

  #---------------------------------------------------------------------
  # Host platform and hardware configurations
  #---------------------------------------------------------------------
  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  networking.useDHCP = lib.mkDefault true;

}
