about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-01-27T11·39+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-27T11·39+0000
commitfb51c8b458bab2002949b3fad9aaaccda035196d (patch)
treebf9d5e974452e5d7054ec04fbd98067c8f2148f7
parentd1fdc9fa637a46c9dcc5eb996d5c16b5c9cc074b (diff)
Support nix-eval fish function
Wrapping the `nix eval` incantation in a fish function for two reasons:
1. Document that this is how to evaluate Nix from a file.
2. Provide a more ergonomic way of evaluating Nix from a file.
-rw-r--r--configs/shared/.config/fish/config.fish10
1 files changed, 8 insertions, 2 deletions
diff --git a/configs/shared/.config/fish/config.fish b/configs/shared/.config/fish/config.fish
index 830b4bb19d9e..eeb799c717bc 100644
--- a/configs/shared/.config/fish/config.fish
+++ b/configs/shared/.config/fish/config.fish
@@ -1,6 +1,5 @@
 # While I work use a variety of programs, below of some of my more commonly used
-# programs that I have decided to support with aliases.
-# Applications
+# programs that I have decided to support with aliases. # Applications
 #   java:       jv
 #   tmux:       t
 #   $EDITOR:    e
@@ -76,6 +75,13 @@ function fish_prompt
     echo -e "\n$suffix "
 end
 
+function nix-eval --description 'Evaluate Nix expression from file, $1.'
+    # Notice the empty string at the end of the invocation here. This is
+    # intentional. For more information, see this issue:
+    # https://github.com/NixOS/nix/issues/2078
+    nix eval --file $argv[1] ""
+end
+
 # Setup fzf for fuzzily finding commands, files, directories
 source (fzf-share)/key-bindings.fish && fzf_key_bindings