{
  config,
  lib,
  ...
}:
let
  cfg = config.mjallen.shell-aliases;
in
{
  options.mjallen.shell-aliases = {
    enable = lib.mkEnableOption "Common shell aliases";

    buildHost = lib.mkOption {
      type = lib.types.str;
      default = "admin@10.0.1.3";
      description = "Build host for nixos-rebuild commands";
    };

    flakeInputs = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [ ];
      description = "List of flake inputs to update";
    };

    extraAliases = lib.mkOption {
      type = lib.types.attrsOf lib.types.str;
      default = { };
      description = "Additional host-specific aliases";
    };
  };

  config = lib.mkIf cfg.enable {
    programs.zsh.shellAliases = {
      # Common file operations
      ll = "ls -alh";
      ducks = "du -cksh * | sort -hr | head -n 15";

      # NixOS rebuild commands
      update-boot =
        "sudo nixos-rebuild boot --max-jobs 10"
        + lib.optionalString (cfg.buildHost != "") " --build-host ${cfg.buildHost}";
      update-switch =
        "sudo nixos-rebuild switch --max-jobs 10"
        + lib.optionalString (cfg.buildHost != "") " --build-host ${cfg.buildHost}";

      # Flake update command
      update-flake = lib.mkIf (
        cfg.flakeInputs != [ ]
      ) "nix flake update ${lib.concatStringsSep " " cfg.flakeInputs} --flake /etc/nixos";

      # NAS management
      update-nas = "nixos-rebuild switch --use-remote-sudo --target-host admin@10.0.1.3 --build-host admin@10.0.1.3 --flake ~/nix-config#jallen-nas";
      nas-ssh = "kitten ssh admin@10.0.1.3";
    }
    // cfg.extraAliases;
  };
}
