{ config, pkgs, ... }:

{
  imports = [ configuration.nix ];

  nixpkgs.config.allowUnfree = true;

  time.timeZone = "Europe/Rome";

  fileSystems."/tmp" = {
    device = "tmpfs";
    fsType = "tmpfs";
    options = ["size=2G"];
  };

  fileSystems."/home/giulio/Downloads" = {
    device = "tmpfs";
    fsType = "tmpfs";
    options = ["size=3G"];
  };

  boot = {
    loader.efi.canTouchEfiVariables = true;
    loader.efi.efiSysMountPoint = "/boot/efi";

    loader.systemd-boot.enable = true;

    initrd.luks.devices = {
      root = {
        device = "/dev/disk/by-uuid/c2bac3a6-0999-4e1d-a676-bf4bcafee2d4";
        preLVM = true;
        allowDiscards = true;
      };
    };
  };

  networking = {
    hostName = "gAluminum";
    wg-quick.interfaces = {
      giupi = {
        address = ["10.3.0.2/32"];
        privateKeyFile = "/etc/wireguard/giupi.key";
        dns = ["10.3.0.1"];
        peers = [
          {
            publicKey = "I4glUMvIGjjhvQMKhwGc8copPl2t9Us/YYRjT0BKuiw=";
            allowedIPs = ["0.0.0.0/0"];
            endpoint = "giugl.io:1194";
            persistentKeepalive = 25;
          }
        ];
      };
    };
  };

  services = {

    xserver = {
      enable = true;
      displayManager.gdm.enable = true;
      desktopManager.gnome.enable = true;
      libinput.enable = true;
      layout = "us";
      xkbOptions = "eurosign:e";
    };

    printing.enable = true;
    dbus.packages = with pkgs; [ gnome3.dconf ];
    udev.packages = with pkgs; [ gnome3.gnome-settings-daemon ]; 
  };


  sound.enable = true;
  hardware.pulseaudio.enable = true;

  environment.systemPackages = with pkgs; [
    wget
    git
    pciutils
    curl
    virtualbox
    cmake
    ninja
    gdb
    htop
    glances
    tcpdump
    restic
    gnomeExtensions.appindicator
    binutils
    efibootmgr
    neovim
    home-manager
  ];

  fonts.fonts = with pkgs; [cascadia-code];

  system.stateVersion = "21.05"; # Did you read the comment?

  security.pam.services.gdm.enableGnomeKeyring = true;

}