2

I'd like to add functionality relating to the awscli command completion.

In my particular case I need to source the script from /nix/store/hvx7xqvjz7r08nsb9kssh1d9s302v3sp-awscli-1.16.106/share/zsh/site-functions/aws_zsh_completer.sh.

How can I get the store path (/nix/store/hvx7xqvjz7r08nsb9kssh1d9s302v3sp-awscli-1.16.106) for a package (awscli)? As I don't think hardcoding this reference is ideal.

2

You can use configuration.nix to create a symlink in /etc that points to the file you want to source. Then you simply source said symlink. For example, something like this...

configuration.nix

environment.etc."zsh/zshrc".source = "${pkgs.awscli}/share/zsh/site-functions/aws_zsh_completer.sh";

...would create the symbolic link /etc/zsh/zshrc which would point to /nix/store/hvx7xqvjz7r08nsb9kssh1d9s302v3sp-awscli-1.16.106/share/zsh/site-functions/aws_zsh_completer.sh

Since this is done through configuration.nix, the symbolic link will get updated to the correct path each time you build the system.

Then, you can source /etc/zsh/zshrc in your ~.zshrc.

3

Through nix-locate , install it then update the database with nix-index:

nix-locate "PATTERN"
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.