From 82bab563cd5c092d5596c364bfadb4d0955e744e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 14 Feb 2021 14:43:48 -0500 Subject: [PATCH] Fix incorrect hostname in flake URI on "hey ssh" --- bin/hey | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/hey b/bin/hey index 0cbd0797..63798b83 100755 --- a/bin/hey +++ b/bin/hey @@ -67,9 +67,10 @@ module Hey noerror ? result : exit($?.exitstatus) end end - def self.rebuild(*args, sudo: false) + def self.rebuild(*args, sudo: false, host: nil) + host ||= ENV['HOST'] || `hostname`.rstrip sh ["nixos-rebuild", - "--flake", @@opts[:flake], + "--flake", "#{@@opts[:flake]}##{host}", "--option", "pure-eval", "no", *args], sudo: sudo end @@ -128,14 +129,14 @@ module Hey opts '--fast', "TODO" lambda do |args| Dir.chdir(@@opts[:flake]) do - @@opts[:host] ||= ENV["HOST"] || `hostname`.rstrip args = ["switch"] unless args.length > 0 rebuild(*(@@opts[:"build-host"] ? ["--build-host", @@opts[:"build-host"]] : []), *(@@opts[:"target-host"] ? ["--target-host", @@opts[:"target-host"]] : []), @@opts[:fast] ? "--fast" : nil, @@opts[:debug] ? "--show-trace" : nil, *args, - sudo: !@@opts[:user]) + sudo: !@@opts[:user], + host: @@opts[:host]) end end end