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

Support find-file-at-point or something like it, to open a file referenced by your nix expression #58

Closed
grahamc opened this issue Dec 10, 2018 · 0 comments

Comments

@grahamc
Copy link
Member

grahamc commented Dec 10, 2018

It would be super neato to support the following use cases:

(1) relative paths, pretty easy since it is relative to the current file!

{
  imports = [
    ./macs/nodes/mac5.nix
  ];
}

having the cursor at the beginning of ./macs/nodes/mac5.nix, being able to do C-c C-o or something to open the file.

(2) paths based on NIX_PATH

a bit trickier, but would be pretty neat:

{ pkgs ? import <nixpkgs> }:
null

being on <nixpkgs> and have it open default.nix of the NIX_PATH's nixpkgs. This can be done with nix-instantiate:

grahamc@Morbo> nix-instantiate  --eval -E '<nixpkgs>'
/nix/var/nix/profiles/per-user/root/channels/nixos

of course, this should also support sub-files using the same method:

grahamc@Morbo> nix-instantiate  --eval -E '<nixpkgs/nixos/lib/make-channel.nix>'
/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/make-channel.nix

Ideally version 2 would also support direnv altering the NIX_PATH.

jabranham added a commit to jabranham/nix-mode that referenced this issue Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant