# 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, ... }:

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

  # Firewall
  networking.firewall = {
	  enable = true;
	  allowedTCPPorts = [ 30000 ];
	  allowedUDPPorts = [ 30000 ];
  };

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

  # Flatpak
  services.flatpak.enable = true;

  # Allow Unfree
  nixpkgs.config.allowUnfreePredicate = _: true;
  nixpkgs.config.allowUnfree = true;

  # Keychain
  services.gnome.gnome-keyring.enable = true;
  programs.seahorse.enable = true;
  
  security.pam.services.deadvey.enableGnomeKeyring = true;

  # NFS
  services.nfs.server.enable = true;

  # Printing

  services.avahi = {
  	enable = true;
  	nssmdns4 = true;
  	openFirewall = true;
  };

  services.printing.enable = true;

  # Dwarf Fortress
  

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

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Audio
  security.rtkit.enable = true;
  services.pipewire = {
	  enable = true;
	  alsa.enable = true;
	  alsa.support32Bit = true;
	  pulse.enable = true;
	  # If you want to use JACK applications, uncomment this
	  #jack.enable = true;
  };

  # Enable gpm (mouse in tty)
  services.gpm.enable = true;

  # Enable Hyprland
  programs.hyprland.enable = true; 

  # Enable networking
  networking.networkmanager.enable = true;

  # Enable NTFS support at boot
  boot.supportedFilesystems = [ "ntfs" ];

  # 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";
  };

  # Configure keymap in X11
  services.xserver.xkb = {
    layout = "gb";
    variant = "";
  };


  # Configure console keymap
  console.keyMap = "uk";

  users.users.deadvey = {
    isNormalUser = true;
    description = "deadvey";
    extraGroups = [ "networkmanager" "wheel" "audio" ];
    packages = with pkgs; [ 
    ];
  };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.variables = {
	PKG_CONFIG_PATH = "/run/current-system/sw/lib/pkgconfig";
  	OPENSSL_DIR = "/run/current-system/sw/lib";
  };
  environment.systemPackages = with pkgs; [
    openssl
    cargo
    neovim 
    wget
    git
    hyprland
    ntfs3g
    sway-contrib.grimshot
    gpm
    libnotify
    python312Packages.requests
    python3
    bc
    gnome.gnome-keyring
    glycin-loaders
    gcc
    pkg-config
    nfs-utils
    dwarf-fortress-packages.dwarf-fortress_0_43_05
  ];

  fonts.packages = with pkgs; [
  	  font-awesome_5
    	  noto-fonts
	  noto-fonts-emoji
	  liberation_ttf
	  fira-code
	  fira-code-symbols
	  mplus-outline-fonts.githubRelease
	  dina-font
	  proggyfonts
	  victor-mono
  ];

  # 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;
  # };

  # List services that you want to enable:

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

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # 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 = "unstable"; # Did you read the comment?
}

