diff options
author | William Carroll <wpcarro@gmail.com> | 2022-04-15T17·33-0700 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-04-16T01·09+0000 |
commit | e48b0cc84fb5ee0b5931ddf42b30b54e9348f4ac (patch) | |
tree | 7f9678801723e00d46102a7d97e3aa4fdb61e0cc | |
parent | d843f0bf4cf27b33c6cf134c4bd3dfd4d646cbc8 (diff) |
feat(wpcarro/emacs): Support calling sudo on a remote buffer r/3954
While pattern-matching in Elisp is a bit unsightly, it works :) Change-Id: I6766147095823f1a4e233832b0ef21f4c486e023 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5452 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com> Autosubmit: wpcarro <wpcarro@gmail.com>
-rw-r--r-- | users/wpcarro/emacs/.emacs.d/wpc/ssh.el | 9 | ||||
-rw-r--r-- | users/wpcarro/nixos/ava/hardware.nix | 11 |
2 files changed, 14 insertions, 6 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/ssh.el b/users/wpcarro/emacs/.emacs.d/wpc/ssh.el index eb7debc492be..1179e9036334 100644 --- a/users/wpcarro/emacs/.emacs.d/wpc/ssh.el +++ b/users/wpcarro/emacs/.emacs.d/wpc/ssh.el @@ -41,7 +41,9 @@ ;; enables ControlMaster. (setq tramp-use-ssh-controlmaster-options nil) -(defcustom ssh-hosts '("wpcarro@wpcarro.dev") +(defcustom ssh-hosts '("wpcarro@wpcarro.dev" + "foundation" + "edge") "List of hosts to which I commonly connect.") (defun ssh-sudo-buffer () @@ -49,7 +51,10 @@ (interactive) (with-current-buffer (current-buffer) (if (s-starts-with? "/ssh:" buffer-file-name) - (message "[ssh.el] calling ssh-sudo-buffer for remote files isn't currently supported") + (pcase (s-split ":" buffer-file-name) + (`(,one ,two ,three) (find-file (format "/ssh:%s|sudo:%s:%s" two two three)))) + (find-file + (s-join ":" (-insert-at 2 "|sudo" (s-split ":" buffer-file-name)))) (find-file (format "/sudo::%s" buffer-file-name))))) (defun ssh-cd-home () diff --git a/users/wpcarro/nixos/ava/hardware.nix b/users/wpcarro/nixos/ava/hardware.nix index eb1fff3a8448..9892bdc58185 100644 --- a/users/wpcarro/nixos/ava/hardware.nix +++ b/users/wpcarro/nixos/ava/hardware.nix @@ -2,7 +2,8 @@ { imports = - [ (modulesPath + "/installer/scan/not-detected.nix") + [ + (modulesPath + "/installer/scan/not-detected.nix") ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; @@ -11,16 +12,18 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/60d92789-c44e-4620-885d-1d81d0759f1d"; + { + device = "/dev/disk/by-uuid/60d92789-c44e-4620-885d-1d81d0759f1d"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/C62C-9B32"; + { + device = "/dev/disk/by-uuid/C62C-9B32"; fsType = "vfat"; }; - swapDevices = []; + swapDevices = [ ]; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; # high-resolution display |