NixOS / nix-mode

An Emacs major mode for editing Nix expressions.
GNU Lesser General Public License v2.1
298 stars 76 forks source link

Consider adding a magit-like interface for interacting with Nix #104

Open cjbassi opened 4 years ago

cjbassi commented 4 years ago

The emacs guix package has implemented this feature and it looks really great: https://github.com/alezost/guix.el. Would it be possible to add this feature to this package or should it be done in a separate package? Thanks.

yilinwei commented 4 years ago

I can't speak for the maintainers but I do think that having a good porcelain would really help newcomers to nix in general - it's not for nothing that magit is so widely used!

That said, I think it would be good to put this in a separate repository for now, with the eventual goal of merging back upstream once it's stable. I'm fairly new as a nix-user but I'm happy to collaborate with anyone who has a better idea of what should go in a porcelain.

akirak commented 3 years ago

Granted that nix commands support the docopt syntax, I think docopt.el can help with this issue. I don't know if it does. nix-build doesn't seem to provide --help flag, and it displays a man page instead.

nagy commented 3 years ago

I want to take this on. I have used emacs-guix in the past and know how it works. I have published the first part of this at #134 which addresses store-paths. The next step in my opinion would be and interaction on objects in the Repl. This can give us access to package information and metadata that is lost in the store, such as homepages, licenses and srcs.

akirak commented 2 years ago

I am currently working on a transient wrapper for flake commands (see #140). As there are so many commands in Nix and some of them are even experimental, I have implemented only a small subset of them such as nix build, nix run, and nix flake check/lock/update. Support for the flags is also limited, based on my usage. Think of it as a proof of concept, but it has been already useful for me.

The main entry point is nix-flake, which lets you dispatch a flake command.

I have also implemented nix-flake-init, which lets you initialize a new project from a template in the registry. It has a limited support for the registry.

Because it depends on private functions from nix.el, it would be better to maintain the library in the same repository as nix.el, but I don't mind if I will have to maintain it in my repository as a separate package.

I think it may need refinement, so I will mark the PR as a draft. Any feedback is welcome.