# 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’).

{
  config,
  pkgs,
  home-manager,
  lib,
  ...
}:

{
  # Bootloader
  #boot.loader.limine.enable = true;
  #boot.loader.systemd-boot.enable = true;
  #boot.loader.limine.secureBoot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  #programs.nix-ld = { enable = true; libraries = pkgs.steam-run.fhsenv.args.multiPkgs pkgs; }; # for dynamically links execs

  # Enable networking
  #networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Europe/London";

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

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_GB.UTF-8";
    LC_IDENTIFICATION = "en_GB.UTF-8";
    LC_MEASUREMENT = "en_GB.UTF-8";
    LC_MONETARY = "en_GB.UTF-8";
    LC_NAME = "en_GB.UTF-8";
    LC_NUMERIC = "en_GB.UTF-8";
    LC_PAPER = "en_GB.UTF-8";
    LC_TELEPHONE = "en_GB.UTF-8";
    LC_TIME = "en_GB.UTF-8";
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.admin = {
    isNormalUser = true;
    description = "admin";
    shell = pkgs.zsh;
    extraGroups = [
      #"networkmanager"
      "wheel"
      "adbusers" # adb
      "kvm" # virt
      "networkmanager"
      "lp" #printing
    ];
    packages = with pkgs; [
    ];
  };

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # Enable the OpenSSH daemon.
  services.openssh.enable = true;

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

  programs = {
    zsh.enable = true;
  };

  nix = {
    extraOptions = ''
      keep-outputs = true
      keep-derivations = true
    '';
    gc.automatic = true;
    gc.randomizedDelaySec = "14m";
    gc.options = "--delete-older-than 10d";
    optimise.automatic = true;
  };

  # unfree
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    # nvidia
    "nvidia-x11"
    "nvidia-settings"
    # cuda
    "cuda_cudart"
    "cuda_nvcc"
    "cuda_cccl"
    "libcublas"
    "cuda-merged"
    "cuda_cuobjdump"
    "cuda_gdb"
    "cuda_nvdisasm"
    "cuda_nvprune"
    "cuda_cupti"
    "cuda_cuxxfilt"
    "cuda_nvml_dev"
    "cuda_nvrtc"
    "cuda_nvtx"
    "cuda_profiler_api"
    "cuda_sanitizer_api"
    "libcufft"
    "libcurand"
    "libcusolver"
    "libnvjitlink"
    "libcusparse"
    "libnpp"
    # other
    "proton-authenticator"
    "obsidian"
    "via"
    "steam"
    "steam-unwrapped"
    "osu-lazer-bin"
    "corefonts"

    "claude-code"

	"brgenml1lpr"
  ];

  environment.systemPackages = with pkgs; [
    zsh
    htop
    fastfetch
    restic
    nixpkgs-fmt
    nixfmt-rfc-style
    rsync
    lm_sensors
    pciutils # lspci
    usbutils # lsusb
    nmap
    tree
    p7zip
    inetutils # telnet

    # media
    yt-dlp
    exiftool
    mediainfo
    ffmpeg-full

    # barcodes
    qrencode
    zbar
    barcode
    ghostscript

    # documenation
    man-pages
    man-pages-posix
  ];

  # enable developer documenation
  documentation.dev.enable = true;
}
