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

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

{
  imports = [
    inputs.nixos-apple-silicon.nixosModules.default
    inputs.home-manager.nixosModules.default
    ../../modules

    # Default specialisation
    ({ lib, config, ... }: {
      config = lib.mkIf (config.specialisation != { }) {
        snowhawk.hyprland.enable = true;
      };
    })
  ];

  # boot.binfmt.emulatedSystems = [
  #   "x86_64-linux"
  #   "i686-linux"
  # ];

  # Install/enable all proprietary firmware
  # hardware.enableAllFirmware = true;

  environment.sessionVariables.MOZ_GMP_PATH = [
    "${pkgs.widevine-cdm}/share/google/chrome/WidevineCdm/manifest.json"
  ];

  snowhawk = {
    filesystem.enable = true;
    user.enable = true;
    env.enable = true;
    sops.enable = true;

    audio.enable = true;
  };

  snowhawk.plymouth = {
    enable = true;
    theme = "owl";
  };

  specialisation = {
    plasma.configuration = {
      environment.etc."specialisation".text = "plasma";

      services.xserver.enable = true;
      services.displayManager.sddm.enable = true;
      services.desktopManager.plasma6.enable = true;

      services.hypridle.enable = true;
      systemd.user.services.hypridle.path = [ pkgs.brightnessctl ];
    };
  };


  documentation = {
    enable = true;
    dev.enable = true;
    man.enable = true;
  };

  home-manager = {
    users = { "ravenshade" = import ./home.nix; };
    backupFileExtension = "backup";
    useGlobalPkgs = true;
  };

  # programs.steam.enable = true;
  # hardware.graphics.enable32Bit = lib.mkForce false;

  services.flatpak.enable = true;
  systemd.services.flatpak-repo = {
    wantedBy = [ "multi-user.target" ];
    path = [ pkgs.flatpak ];
    script = ''
      flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    '';
  };

  environment.systemPackages = with pkgs; [
    pkgs.rose-pine-gtk-theme
    pkgs.rose-pine-icon-theme
    pkgs.adwaita-icon-theme

    neovim
    bashmount
    curl
    git
    killall

    iwd
    iwgtk

    gparted
    exfatprogs

    linux-manual

    inputs.nh.packages.${pkgs.system}.default
  ];

  environment.variables.NH_FLAKE = "/home/ravenshade/.config/nixos";
  environment.variables.NIXOS_OZONE_WL = 1;

  fonts.packages = with pkgs; [
    nerd-fonts.jetbrains-mono
  ];

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Set your time zone.
  time.timeZone = "America/Los_Angeles";
  # 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 = "23.11"; # Did you read the comment?
}