# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
  inputs,
  outputs,
  pkgs,
  ...
}: {
  # You can import other NixOS modules here
  imports = [
    # Import home-manager's NixOS module
    inputs.home-manager.nixosModules.home-manager
    outputs.nixosModules.vpn-ip
    inputs.jovian.nixosModules.jovian
    # If you want to use modules your own flake exports (from modules/nixos):
    # outputs.nixosModules.example

    # Or modules from other flakes (such as nixos-hardware):
    # inputs.hardware.nixosModules.common-cpu-amd
    # inputs.hardware.nixosModules.common-ssd

    # You can also split up your configuration and import pieces of it here:
    # ./users.nix

    ../../desktop

    ../../../disko/GLaDOS

    # Import your generated (nixos-generate-config) hardware configuration
    ./hardware-configuration.nix
  ];

  environment.systemPackages = with pkgs; [
  ];

  services.vpn-ip = {
    ip = "2";
  };

  networking.hostName = "GLaDOS";

  services.xserver.videoDrivers = ["amdgpu"];
  hardware = {
    # Add vulkan support to GPU
    graphics.extraPackages = with pkgs; [
      amdvlk
    ];
    # For 32 bit applications
    graphics.extraPackages32 = with pkgs; [
      driversi686Linux.amdvlk
    ];
  };
  programs = {
    # gamemode.enable = false;
    # gamemode.settings = {
    #   general = {
    #     renice = 10;
    #   };

    #   # Warning: GPU optimisations have the potential to damage hardware
    #   # gpu = {
    #   #   apply_gpu_optimisations = "accept-responsibility";
    #   #   gpu_device = 0;
    #   #   amd_performance_level = "high";
    #   # };

    #   custom = {
    #     start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
    #     end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
    #   };
    # };
  };

  jovian = {
    steam = {
      enable = true;
      autoStart = false;
      user = "lillian";
      desktopSession = "plasma";
    };
    decky-loader = {
      enable = true;
      package = pkgs.decky-loader-prerelease;
      extraPackages = [pkgs.python3];
    };
    hardware.has.amd.gpu = true;
  };

  boot = {
    loader.systemd-boot.enable = false;
  };

  boot.lanzaboote = {
    enable = true;
    pkiBundle = "/var/lib/sbctl";
  };

  users.users.lillian.extraGroups = ["gamemode"];

  # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
  system.stateVersion = "25.05";
}