{
  config,
  pkgs,
  lib,
  ...
}: let
  home-manager = builtins.fetchTarball {
    url = "https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz?nocache=1";
    sha256 = "WzBOBfSay3GYilUfKaUa1Mbf8/jtuAiJIedx7fWuIX4=";
  };
  cfg = config.services.forgejo;
  srv = cfg.settings.server;
in {
  # Home Manager Configuration
  imports = [
    # Include the results of the hardware scan.
    (import "${home-manager}/nixos")
  ];

  # Enable the gnome-keyring secrets vault.
  # Will be exposed through DBus to programs willing to store secrets.
  services.gnome.gnome-keyring.enable = true;

  # Configure security to allow seatd access
  security.polkit.enable = true;

  # Consolidated Sway desktop: includes greetd, alacritty, hyfetch/fastfetch, a Nerd Font and librewolf
  # Enable Sway window manager
  programs.sway = {
    enable = true;
    wrapperFeatures.gtk = true;
  };

  # Enable Seatd for Wayland sessions
  services.seatd = {
    enable = true;
    logLevel = "info";
  };

  services.greetd.enable = true;
  services.greetd.settings = {
    default_session = {
      command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd sway";
      user = "greeter";
    };
  };

  home-manager.users.${config.local.username} = {pkgs, ...}: {
    home.packages = [
      pkgs.atool
      pkgs.httpie
      pkgs.alacritty # Terminal emulator
      pkgs.hyfetch # Add fetching packages
      pkgs.macchina # Other "neofetch"
      pkgs.librewolf # Web browser, Firefox but better
      pkgs.wayland # Wayland display server
      pkgs.wlroots # Wayland compositor library
      pkgs.maple-mono.NF # Font for better terminal appearance
      pkgs.wl-clipboard # Clipboard utilities for Wayland
      pkgs.mako # Wayland Sway Notification Daemon
      pkgs.btop # Resource monitor
    ];

    # Set Alacritty as the default terminal emulator
    home.sessionVariables = {
      TERMINAL = "alacritty";
    };

    # Use Zsh as the default shell
    programs.zsh.enable = true;

    # Configure Alacritty as the default terminal emulator
    programs.alacritty = {
      enable = true;
      settings = {
        # Window configuration
        window = {
          opacity = 1.0;
          padding = {
            x = 10;
            y = 10;
          };
        };

        # Font configuration - fixes spacing issues
        font = {
          normal = {
            family = "Maple Mono NF";
            style = "Regular";
          };
          bold = {
            family = "Maple Mono NF";
            style = "Bold";
          };
          italic = {
            family = "Maple Mono NF";
            style = "Italic";
          };
          bold_italic = {
            family = "Maple Mono NF";
            style = "Bold Italic";
          };
          size = 14.0;
        };

        # Colors (optional - using default Alacritty colors)
        colors = {
          primary = {
            background = "#1e1e2e";
            foreground = "#cdd6f4";
          };
        };
      };
    };

    # Configure Hyfetch system info fetcher
    programs.hyfetch = {
      enable = true;
      settings = {
        preset = "lesbian"; # Use lesbian flag preset
        mode = "rgb"; # Use RGB color mode
        lightness = 0.55; # Set to 55% brightness
        backend = "macchina"; # Use macchina as the backend
        logo_size = "small"; # Make small logo
        pride_month_disable = false; # Enable pride month mode (or true to disable)
        pride_month_shown = []; # List of shown pride month flags
        color_align = {
          mode = "horizontal";
        };
      };
    };

    # The state version is required and should stay at the version you
    # originally installed.
    home.stateVersion = "25.11";
  };
}
