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

{
  environment.systemPackages = let
    moose = inputs.moose.packages.${pkgs.system}.default;
  in 
  with pkgs; [
    lf
    jq
    gh
    git
    wget
    wine
    curl
    htop
    unzip
    seatd
    libgcc
    gnumake
    gparted
    dnsmasq
    pciutils
    onefetch
    python315
    playerctl
    p7zip-rar
    fastfetch
    pkg-config
    kdePackages.qt6ct
    lxqt.lxqt-policykit
    neovim
    google-fonts
    ffmpeg_7-full
    libGL
    discord
    proton-vpn
    wireguard-tools

    moose
  ];

  services.flatpak = {
    enable = true;
    packages = [
      "com.github.tchx84.Flatseal"
      "com.dec05eba.gpu_screen_recorder"
      "org.geogebra.GeoGebra"
    ];
  };

  fonts = {
    enableDefaultPackages = true;
    packages = with pkgs; [
      adwaita-fonts
      jetbrains-mono
      nerd-fonts.jetbrains-mono
      google-fonts
      material-symbols
      material-icons
    ];
    fontconfig = {
      enable = true;
      defaultFonts = {
        sansSerif = [ "Adwaita Sans" ];
        monospace = [ "JetBrains Mono" "Adwaita Mono" ];
      };
    };
  };

  #nix.gc = {
  #  automatic = true;
  #  dates = "weekly";
  #  options = "--delete-older-than 7d";
  #};

  environment.variables = {
    QT_QPA_PLATFORMTHEME = "qt6ct";
    EDITOR = "moose";
  };

  services.xserver.xkb = {
    layout = "no";
    variant = "winkeys";
  };
  console.keyMap = "no";

  time.timeZone = "Europe/Oslo";

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

  security.polkit.enable = true;

  programs.nix-ld.enable = true;

  programs.firefox.enable = true;
  programs.noisetorch.enable = true;

  #programs.appimage = {
  #  enable = true;
  #  binfmt = true;
  #  package = pkgs.appimage-run.override {
  #    extraPkgs = pkgs: 
  #    [
  #      pkgs.icu
  #      pkgs.libxcrypt-legacy
  #      pkgs.python312
  #      pkgs.python312Packages.torch
  #      pkgs.zstd
  #    ]; 
  #  };
  #};

  programs.nh = {
    enable = true;
    clean.enable = true;
    clean.extraArgs = "--keep-since 4d --keep 3";
    flake = "$HOME/nix-dots/";
  };

  hardware.graphics = {
    enable = true;
    enable32Bit = true;
  };

  services.seatd.enable = true;
  services.gvfs.enable = true;

  virtualisation.libvirtd.enable = true;
  programs.virt-manager.enable = true;

  virtualisation.docker.enable = true;
  virtualisation.docker.storageDriver = "btrfs";

  systemd.user.extraConfig = ''
    DefaultTimeoutStopSec=10s
  '';
}