abathur / resholve

a shell resolver? :) (find and resolve shell script dependencies)
MIT License
231 stars 5 forks source link

exercer rule not being applied #105

Closed iogrt closed 1 year ago

iogrt commented 1 year ago

Hello, first of all thanks for making this program. I really like the idea of having more control over bash scripts in my NixOS system.

I have a bash script called fanger and I was tried to apply a custom exercer rule to it, without success:

 > [resholve context] : invoking resholve with PWD=/nix/store/m0f6vnn5a8lmsj0c64kracmsy29p3ca8-fanger
       > [resholve context] RESHOLVE_LORE=/nix/store/hgrl1izb5lh1rpr1yhn068fsq9hd72y3-more-binlore
       > [resholve context] RESHOLVE_EXERCER=cannot:/nix/store/b8f1l8xliqcg8iz2xx7gms0k88r99ykr-fzf-0.40.0/bin/fzf
       > [resholve context] RESHOLVE_INPUTS=/nix/store/b8f1l8xliqcg8iz2xx7gms0k88r99ykr-fzf-0.40.0/bin
       > [resholve context] RESHOLVE_INTERPRETER=/nix/store/8fv91097mbh5049i9rglc73dx6kjg3qk-bash-5.2-p15/bin/bash
       > [resholve context] /nix/store/flhjs88iz0mczaw3qifci7smxx1gaq0y-resholve-0.9.0/bin/resholve --overwrite bin/fanger
       >   nav=$(ls -ap --color=always -1 | fzf --ansi -q "/ " --header="$(pwd)")
       >                                    ^~~
       > '/nix/store/m0f6vnn5a8lmsj0c64kracmsy29p3ca8-fanger/bin/fanger':2: 'fzf' _might_ be able to execute its arguments, and I don't have any command-specific rules for figuring out if this specific invocation does or not.

I had this error before and I looked into providing binlore through exercer. But as you can see the lore is provided and the error still continues.

Is this a misconfiguration on my side? Is the bash expression too complex? Or potentially a bug?

abathur commented 1 year ago

Is the nix expression public?

abathur commented 1 year ago

Now that I'm at a computer I see the issue:

RESHOLVE_EXERCER should be RESHOLVE_EXECER. If you're using the Nix API, this public example using fzf may help clarify:

https://github.com/PedroHLC/system-setup/blob/513dec0a3b59d28022e9a69bd826e26fc75b0b7b/shared/pkgs/fzf-bluetooth.nix#L32-L45

iogrt commented 1 year ago

Thanks for the quick response, and yes it was just a typo inside resholve.writeScriptBin. I thought it was correct since a variable was getting set, but I see how any attr gets set there.