{ host }:
{
  pkgs,
  lib,
  config,
  ...
}:
let
  common = (import ../common/home.nix) { inherit pkgs; };
  overwrite = {
    home.username = host.username;
    home.homeDirectory = "/Users/${host.username}";

    home.packages =
      common.home.packages
      ++ (import ./pkgs.nix { inherit pkgs; })
      ++ ((lib.attrByPath [ "extras" "pkgs" ] (pkgs: [ ]) host) pkgs);

    fonts.fontconfig.enable = true;

    home = {

      activation.zedConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
        mkdir -p ~/.config
        if [ ! -L ~/.config/zed ]; then
          rm -rf ~/.config/zed
          ln -sf ~/.config/dotfiles/secrets/zed ~/.config/zed
        fi
      '';

      file = {
        ".config/ghostty/config".source = ../files/ghostty/config;
        ".gitconfig".source = ../files/git/gitconfig;
        ".gitignore_global".source = ../files/git/gitignore_global;
        ".gitconfig.local".source = ../secrets/git/config.${host.hostName};
        ".config/lazygit/config.yml".source = ../files/lazygit/config.yaml;
        ".config/lazydocker/config.yml".source = ../files/lazydocker/config.yml;

        # Secrets
        ".ssh/config".text = builtins.replaceStrings [ "@SSH_KEY@" ] [ host.sshKey ] (
          builtins.readFile ../secrets/ssh/config.template
        );
      };

      shellAliases = {
        p = "pnpm";
        px = "pnpm -s dlx";
        n = "fnm use --install-if-missing";
        c = "pwd | pbcopy";

        vai = "sudo darwin-rebuild switch --flake ~/.config/dotfiles#${host.hostName}";
        clean = "nix-collect-garbage -d";
      };

      sessionVariables = {
        XDG_CONFIG_HOME = "$HOME/.config";
      };
    };
  };

  merged = lib.recursiveUpdate common overwrite;
in
merged
