How can I define alias in shellHook
? I have tried something like this, but it doesn’t work. I think I have addressed the non-interactive shell issue by setting shopt -s expand_aliases
there?
{
description = "Testing flake for alias";
outputs = { self, nixpkgs }:
let system = "x86_64-linux";
in {
devShell.${system} = (({ pkgs, ... }:
let
alias = pkgs.writeShellScriptBin "test-alias" ''
shopt -s expand_aliases
alias foo=nvim
'';
in pkgs.mkShell {
buildInputs = with pkgs; [
alias
];
shellHook = ''
echo ${alias}/bin/test-alias
source ${alias}/bin/test-alias
export hello=world
'';
}) { pkgs = nixpkgs.legacyPackages.${system}; });
};
}