bin/hey: fix repl command

Now loads nixpkgs and dotfiles flake.
This commit is contained in:
Henrik Lissner 2021-02-28 22:29:55 -05:00
parent 9e15da7f36
commit ab2e052ba3

View file

@ -87,7 +87,13 @@ module Hey
defcmd :repl do
desc "Open a nix-repl with nixpkgs and dotfiles preloaded"
lambda do |args|
sh ["nix", "repl", "<nixpkgs>", *args]
tempfile = '/tmp/dotfiles-repl.nix'
File.write('/tmp/dotfiles-repl.nix', "(builtins.getFlake \"#{@@opts[:flake]}\")")
begin
sh ["nix", "repl", "<nixpkgs>", tempfile, *args]
ensure
File.delete tempfile
end
end
end