I don’t know the problem - what is the exact symptom you’re seeing? - but you could try setting a shell-specific alias instead. I presume you’ve somehow arranged for aws to be on your $PATH?
Yes, aws works.
By the “alias is not” working, I meant that that on executing asl it can’t recognise it at all.
asl
zsh: command not found: asl
I intended to move this alias from my .zshrc to home.shellAliases because I understand that this way, these aliases will accessible from other shells like fish as well right?
I had the same problem. The reason is that home-manager is simply passing the value of home.shellAliases to programs.{bash,zsh,fish}.shellAliases as you can see here:
To make these aliases work, you need to actually enable one of these shells in your home-manager configuration, which I had not - I had enabled programs.zsh only globally in my configuration.nix, and so home-manager never had a reason to generate a ~/.zshrc for me.
Beware though that programs.zsh in home-manager comes with some settings enabled by default, which might override your global settings (for example programs.zsh.history.size = 10000, which overrode the programs.zsh.histSize = 100000 in my configuration.nix). Check the generated ~/.zshrc and customize your programs.zsh settings per Appendix A. Home Manager Configuration Options to sort this out.