# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

# shopt -s histappend
# make this work later


{ inputs, config, pkgs, lib, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      ./modules.nix
    ];

  #Chinese mirror
  #  nix.settings.substituters = [ "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" ];

  nix.settings = {
    substituters = ["https://cache.garnix.io"];
    trusted-public-keys = [
      "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
    ];
  };

  nix.settings.experimental-features = [ "nix-command" "flakes" ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot";

  networking.hostName = "laptop"; # Define your hostname.

  # Set your time zone.
  time.timeZone = "Asia/Shanghai";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  console.useXkbConfig = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.iopq = {
    isNormalUser = true;
    description = "Igor";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      firefox
      thunderbird
      git
      tdesktop

      wineWowPackages.stagingFull #contains more stuff that changes between versions to let Battle.net launch StarCraft
      wineWowPackages.fonts
      winetricks


      krita
      vlc
      kodi
      mpv

      chromium

      stuntman
      pavucontrol

      p7zip
      wireplumber

      dig
      nftables
      samba #ntlm_auth for starcraft

      tcping-go
      nexttrace

      #xray
      iptables

      pijul

      scummvm
      telegram-desktop
      libreoffice

      bitcoin

      wget
      awscli2

      jq
      oci-cli

      anki

  (wrapOBS {
        plugins = [ obs-studio-plugins.obs-vkcapture
          obs-studio-plugins.wlrobs];
      })
    ];
  };

  nixpkgs.config.firefox.speechSynthesisSupport = true;

  environment.sessionVariables = {
    QT_QPA_PLATFORM = "wayland";
    __NV_DISABLE_EXPLICIT_SYNC = "1";
    HISTSIZE = "900";
    HISTFILESIZE = "900";
  };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    go
    gcc
    nix-prefetch-github
    mission-center
    libva-utils
    tuxclocker
    killall
  ];

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "23.11"; # Did you read the comment?

}