# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).

{
  lib,
  pkgs,
  ...
}:
let
  pkgsVersion = pkgs; # .unstable;
  environmentVariables = {
    STEAM_FORCE_DESKTOPUI_SCALING = "1.0";
    GDK_SCALE = "1";
    EDITOR = "${pkgs.vscodium}/bin/codium --wait";
    VISUAL = "${pkgs.vscodium}/bin/codium --wait";
  };
  systemPackages = with pkgsVersion; [
    acpilight
    aha
    aspell
    aspellDicts.en
    aspellDicts.en-computers
    aspellDicts.en-science
    borgbackup
    brightnessctl
    # brscan5
    ddcui
    ddcutil
    # ddccontrol
    # ddccontrol-db
    efibootmgr
    kdePackages.ksvg
    memtest86-efi
    memtest86plus
    os-prober
    nil
    qemu
    rclone
    rclone-browser
    restic
    restic-browser
    restic-integrity
    sane-frontends
    sbctl
    tpm2-tools
    tpm2-tss
    udisks2
    unzip
    winetricks
  ];
in
{
  chaotic.mesa-git.enable = false;

  # Environment configuration
  environment = {
    systemPackages = systemPackages;

    variables = environmentVariables;
  };

  # Hardware configuration
  hardware = {
    # Enable the QMK firmware flashing tool.
    keyboard = {
      qmk.enable = false;
    };

    # Enable Sane and Brother printer support.
    sane = {
      enable = true;
      brscan5.enable = false;
      # extraBackends = [ pkgsVersion.brscan5 ];
    };
    flipperzero.enable = true;
  };

  # Common Configuration
  share = {
    gaming.enable = true;
    hardware.amd = {
      enable = lib.mkDefault true;
      lact.enable = lib.mkDefault true;
    };
  };

  programs.coolercontrol.enable = true;

  # Time configuration
  time = {
    hardwareClockInLocalTime = lib.mkDefault false;
  };

  # Virtualisation configuration
  virtualisation = {
    libvirtd.enable = lib.mkDefault true;
    podman.enable = true;
    waydroid.enable = lib.mkDefault true;
  };

  services.udev.extraRules = ''
    KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"
  '';
}
