Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
img
 
 
 
 
 
 

README.org

Nix Options – A set of useful Emacs modes and functions for users of Nix and Nix OS.

nixos-optionshelm-nixos-optionscompany-nixos-optionsnix-sandbox
http://melpa.org/packages/nixos-options-badge.svghttp://melpa.org/packages/helm-nixos-options-badge.svghttp://melpa.org/packages/company-nixos-options-badge.svghttps://melpa.org/packages/nix-sandbox-badge.svg

https://badges.gitter.im/Join Chat.svg https://badge.waffle.io/travisbhartwell/nix-emacs.svg

Usage

helm-nixos-options

The function helm-nixos-options is the one that you want to bind. You are free to choose where and if you want it global you can have this.

(global-set-key (kbd "C-c C-S-n") 'helm-nixos-options)

It looks like this img/helm-nixos-options-candidates.png

The description of the option is shown in the minibuffer

If you want more information, there is a detailed buffer when you press return

img/helm-nixos-options-doc-buffer.png

There are also other actions like inserting the current match into the buffer

img/helm-nixos-options.gif

company-nixos-options

Add company-nixos-options to allowed company-mode backends list

(add-to-list 'company-backends 'company-nixos-options)

For now it shows the documentation of the option in a popup-buffer.

img/company-nixos-options.gif

nix-sandbox

Utility functions to work with nix sandboxes.

  • nix-shell-command composes command that can be executed in the given sandbox
  • nix-shell executes a command in the given sandbox
  • nix-compile compiles a program in the given sandbox
  • nix-find-sandbox searches from the given path upwards until it finds a shell.nix or default.nix file.
  • nix-current-sandbox searches for a sandbox file starting from the current working directory.
  • nix-executable-find a replacement for the built-in executable-find. The function searches in the given sandbox for executables.

Flycheck

With this configuration flycheck can find executables of checkers that would be only accessible via nix-shell:

(setq flycheck-command-wrapper-function
        (lambda (command) (apply 'nix-shell-command (nix-current-sandbox) command))
      flycheck-executable-find
        (lambda (cmd) (nix-executable-find (nix-current-sandbox) cmd)))

Haskell Mode

Add these lines to your configuration to allow haskell-mode to look for ghc in the current sandbox.

(setq haskell-process-wrapper-function
        (lambda (args) (apply 'nix-shell-command (nix-current-sandbox) args)))

About

A set of useful Emacs modes and functions for users of Nix and Nix OS.

Resources

Packages

No packages published
You can’t perform that action at this time.