From 162f04a090c98bc1dbe1d66f5932ee832cfb2507 Mon Sep 17 00:00:00 2001 From: Emmet Date: Wed, 18 Sep 2024 20:32:54 -0500 Subject: [PATCH] quick sudoedit files with nvim --- system/security/doas.nix | 17 ++++++++++++----- user/app/nvim/init.lua | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/system/security/doas.nix b/system/security/doas.nix index 6dfadec..f3ab361 100644 --- a/system/security/doas.nix +++ b/system/security/doas.nix @@ -4,11 +4,18 @@ # Doas instead of sudo security.doas.enable = true; security.sudo.enable = false; - security.doas.extraRules = [{ - users = [ "${userSettings.username}" ]; - keepEnv = true; - persist = true; - }]; + security.doas.extraRules = [ + { + users = [ "${userSettings.username}" ]; + keepEnv = true; + persist = true; + } + { + users = [ "${userSettings.username}" ]; + cmd = "tee"; + noPass = true; + } + ]; environment.systemPackages = [ (pkgs.writeScriptBin "sudo" ''exec doas "$@"'') diff --git a/user/app/nvim/init.lua b/user/app/nvim/init.lua index 1c842e2..79fa3c7 100644 --- a/user/app/nvim/init.lua +++ b/user/app/nvim/init.lua @@ -15,6 +15,8 @@ if vim.g.neovide then vim.g.neovide_cursor_vfx_mode = "pixiedust" end +vim.api.nvim_create_user_command('W', 'execute "silent! write !sudo tee % >/dev/null" edit', { nargs = 0}) + vim.g.neovide_scale_factor = 1.0 -- bootstrap lazy and all plugins