New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mcfly: init at v0.3.1 #52940
mcfly: init at v0.3.1 #52940
Conversation
pkgs/tools/misc/mcfly/default.nix
Outdated
# integration scripts are living. | ||
echo $out/share/mcfly | ||
SCRIPT | ||
chmod +x $out/bin/mcfly-share |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any point in this. Unless you need this there's no point in copying it from other packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary. The comment is just a hint to know where I have it from. Mcfly and fzf are both ctrl+r replacements and thus a file needs to be sourced by bash to use them. This additional command shows the path to this bash script.
I can delete the comment if you think it is confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just about to complain how you can just discover these files by just inspecting the derivations (tree $(nix-build '<nixpkgs>' -A fzf)
), but then I found #27709 which introduced this. And it's in the wiki too.
I personally really dislike this approach. Using binaries to find paths is really weird. How I'd think it should work without such a -share binary is to have packages install these sourceable scripts into a standard location (say $out/share/bash/sourceables
) and then do
for p in $NIX_PROFILES; do
source "$p/share/bash/sourceables/fzf"
source "$p/share/bash/sourceables/autojump"
done
This is also how bash sources its completion scripts:
nixpkgs/nixos/modules/programs/bash/bash.nix
Lines 25 to 29 in 7394efb
for p in $NIX_PROFILES; do | |
for m in "$p/etc/bash_completion.d/"*; do | |
. $m | |
done | |
done |
Alternatively (as just mentioned by @samueldr in #nixos-dev) I can imagine a nix-share
binary usable like this (also requires standard locations for these files):
source $(nix-share fzf)
source $(nix-share autojump)
Maybe also combine these approaches and have a standard bash setup script that creates a function for the for p in $NIX_PROFILES
thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also an entry in the nixpkgs manual. And weirdly enough autojump doesn't have this script anymore, 47aceb0 removed it.
Maybe also combine these approaches and have a standard bash setup script that creates a function for the for p in $NIX_PROFILES thing.
Creating a shell setup script makes sense. I just don't get exactly what you mean with ..that creates a function...
. What kind of function do you mean, what should it do?
What I could think of is a script called something like nix-source
which looks similar to this autojump script, except it also takes a $package
argument like nix-source fzf
to know which sourceable it should load and goes through a for p in $NIX_PROFILES
loop to find the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's best to just remove that convenience script for now, we can always make it more convenient later (but you can never take something convenient away without people complaining).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the part in question and as (ugly) workaround the following works for now:
source $(dirname $(which mcfly))/../share/mcfly/mcfly.bash
@GrahamcOfBorg build mcfly |
@GrahamcOfBorg eval |
@infinisil is it possible for you to merge this PR? I removed the part in question and it should be OK to merge now. |
Yeah, can you squash the commits first? |
ec94104
to
a75e25b
Compare
Motivation for this change
mcfly is a very nice ctrl+r replacement that takes into account your working directory and the context of recently executed commands.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)