Skip to content
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

autojump: rework #40725

Merged
merged 1 commit into from May 22, 2018
Merged

autojump: rework #40725

merged 1 commit into from May 22, 2018

Conversation

yurrriq
Copy link
Member

@yurrriq yurrriq commented May 18, 2018

Motivation for this change

Modernize the package, fix fish completion, and update URLs.

  • fetchurl -> fetchFromGitHub
  • Update URLs: joelthelion -> wting
  • mkdir + cp -> install
  • Use -z flag to set zshshare_dir
  • Add me to meta.maintainers
  • Use rec-ursive version instead of let
  • meta: with stdenv.lib; ...

N.B. I've only tested fish completions.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

- fetchurl -> fetchFromGitHub
- Update URLs: joelthelion -> wting
- mkdir + cp -> install
- Use -z flag to set zshshare_dir
- Add me as a maintainer
- Use recursive version instead of let
- meta: with stdenv.lib; ...
@yurrriq
Copy link
Member Author

yurrriq commented May 18, 2018

/ping @domenkozar

@xeji
Copy link
Contributor

xeji commented May 18, 2018

@GrahamcOfBorg build autojump

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: autojump

Partial log (click to expand)


post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/6dj1hs4cv8ws51s5vbzshylp0mdrzkp5-autojump-22.5.1
gzipping man pages under /nix/store/6dj1hs4cv8ws51s5vbzshylp0mdrzkp5-autojump-22.5.1/share/man/
strip is /nix/store/jk6j4lh9v5mvjdbdc35sj0zffhhf6s56-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/6dj1hs4cv8ws51s5vbzshylp0mdrzkp5-autojump-22.5.1/bin
patching script interpreter paths in /nix/store/6dj1hs4cv8ws51s5vbzshylp0mdrzkp5-autojump-22.5.1
/nix/store/6dj1hs4cv8ws51s5vbzshylp0mdrzkp5-autojump-22.5.1/bin/autojump: interpreter directive changed from "/usr/bin/env python" to "/nix/store/vhz9s1dzzbndz032dysnixj8mxyfl30s-python-2.7.14/bin/python"
checking for references to /build in /nix/store/6dj1hs4cv8ws51s5vbzshylp0mdrzkp5-autojump-22.5.1...
/nix/store/6dj1hs4cv8ws51s5vbzshylp0mdrzkp5-autojump-22.5.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: autojump

Partial log (click to expand)


post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/rs3rkd9x7avan09yq40a9jym7gna7w3c-autojump-22.5.1
gzipping man pages under /nix/store/rs3rkd9x7avan09yq40a9jym7gna7w3c-autojump-22.5.1/share/man/
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/rs3rkd9x7avan09yq40a9jym7gna7w3c-autojump-22.5.1/bin
patching script interpreter paths in /nix/store/rs3rkd9x7avan09yq40a9jym7gna7w3c-autojump-22.5.1
/nix/store/rs3rkd9x7avan09yq40a9jym7gna7w3c-autojump-22.5.1/bin/autojump: interpreter directive changed from "/usr/bin/env python" to "/nix/store/l9j2jsc9flrbmpf799nw9wdq59gpwms8-python-2.7.14/bin/python"
checking for references to /build in /nix/store/rs3rkd9x7avan09yq40a9jym7gna7w3c-autojump-22.5.1...
/nix/store/rs3rkd9x7avan09yq40a9jym7gna7w3c-autojump-22.5.1

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: autojump

Partial log (click to expand)


Please restart terminal(s) before running autojump.

post-installation fixup
gzipping man pages under /nix/store/9i6maxr6zqb6m5xi7s8ly00jkfwpwac2-autojump-22.5.1/share/man/
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/9i6maxr6zqb6m5xi7s8ly00jkfwpwac2-autojump-22.5.1/bin
patching script interpreter paths in /nix/store/9i6maxr6zqb6m5xi7s8ly00jkfwpwac2-autojump-22.5.1
/nix/store/9i6maxr6zqb6m5xi7s8ly00jkfwpwac2-autojump-22.5.1/bin/autojump: interpreter directive changed from "/usr/bin/env python" to "/nix/store/10f4qxb00wk9j6cicd9h1qzwqgnc36ji-python-2.7.14/bin/python"
/nix/store/9i6maxr6zqb6m5xi7s8ly00jkfwpwac2-autojump-22.5.1

@xeji xeji merged commit b72a8a4 into NixOS:master May 22, 2018
@the-kenny
Copy link
Contributor

Until now the recommended way of activating autojump on NixOS was the following:

if type "autojump-share" > /dev/null; then
  source "$(autojump-share)"/autojump.zsh > /dev/null
fi

This PR removes the autojump-share script (which was there to dynamically get location of $out/share). Is there a replacement?

@yurrriq
Copy link
Member Author

yurrriq commented Jun 1, 2018

I'm not a Z shell user, and as I (poorly) stated above, I only tested on fish, but now the site functions are installed to $out/share/zsh/site-functions/, so that should Just Work™, right?

@the-kenny
Copy link
Contributor

the-kenny commented Jun 3, 2018 via email

@yurrriq
Copy link
Member Author

yurrriq commented Jun 3, 2018

Awesome!

@Janiczek
Copy link

How can I make this work with bash? Currently I'm not sure what to put into my ~/.bashrc instead of the autojump-share script. Do I need to have bash-completions installed?

@yurrriq
Copy link
Member Author

yurrriq commented Jul 27, 2018

@Janiczek, I believe so. If you use the programs.bash module, its option enableCompletion defaults to true, so It Should Just Work™. I'm a fish user, so YMMV.

@Janiczek
Copy link

Sorry, a stupid question of a Nix beginner 🙂 Can I do that with Nix installed in Ubuntu (I'm not on NixOS)? Do I use programs.bash module if I just nix-env -iA nixpkgs.bash? (If the answer to both is no, can I make this somehow work on Nix itself?)

@yurrriq
Copy link
Member Author

yurrriq commented Jul 28, 2018

There are no stupid questions! I most often use NixOS or nix-darwin, and don't have much Nix on Linux experience. With that said, you won't be able to use programs.bash, unless there exists a system similar to nix-darwin for Ubuntu. So, in your case, you will need to install bash-completion, and I imagine it will pick up the completions installed by autojump. Let me know how it goes!

@cdepillabout
Copy link
Member

I'm a bash user. Now that the autojump-share function has been removed, I'll need to make sure to source $out/etc/profile.d/autojump.sh on startup so that my PROMPT_COMMAND will be updated automatically.

How does Nix handle that? If there are any profile.d/* files, do these automatically get sourced by /etc/profile?

I currently don't have a /etc/profile.d/ directory, so I'm wondering how this works? I tried to look in nixpkgs to figure out how /etc/profile.d/ is handled, but I couldn't really find anything.

Will this just be handled automatically?

(Note, this is something completely different than autocompletion.)

@yurrriq yurrriq deleted the update/autojump branch August 20, 2018 15:40
@bfortz
Copy link
Contributor

bfortz commented Sep 25, 2018

For users of oh-my-zsh in nixos systems, the autojump plugin is searched for in /run/current-system/sw/shared/autojump/. In 18.03, I disabled the plugin and used autojump-share in my .zshrc. With #47334 the right links are created when programs.autojump.enabled is set to true and the oh-my-zsh autojump plugin works like a charm.

@jabarszcz
Copy link

jabarszcz commented Sep 25, 2018

Nixos beginner here.
From what I understand, bash completions are lazily loaded (since this commit) and thus autojump.bash is no longer sourced by default. I added programs.bash.interactiveShellInit = "source /run/current-system/sw/share/autojump/autojump.bash"; to my configuration and it seems to work, although I am not sure that it is the best way to do this.

@bfortz
Copy link
Contributor

bfortz commented Sep 26, 2018

The best option imo would be to have autojump.bash loaded automatically when programs.autojump.enable is set (and the same should apply to zsh - this would even remove the need for the oh-my-zsh autojump plugin). Done in #47334.

@cdepillabout
Copy link
Member

I added programs.bash.interactiveShellInit = "source /run/current-system/sw/share/autojump/autojump.bash"; to my configuration and it seems to work

On 18.09 I instead had to source "/run/current-system/sw/share/bash-completion/completions/autojump.bash". It is unfortunate autojump-share was removed and this PR was merged without apparently being tested on bash at all.

cdepillabout added a commit to cdepillabout/docs that referenced this pull request Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants