diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index 027e573e40a1..abdebfed61ff 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -774,15 +774,14 @@ self: super: { openscad-nvim = super.openscad-nvim.overrideAttrs (old: { buildInputs = [ zathura htop openscad ]; - patches = [ ./patches/openscad.nvim/program_paths.patch ]; - - postPatch = '' - substituteInPlace lua/openscad.lua --replace '@zathura-path@' ${zathura}/bin/zathura - substituteInPlace autoload/health/openscad_nvim.vim --replace '@zathura-path@' ${zathura}/bin/zathura - substituteInPlace lua/openscad/terminal.lua --replace '@htop-path@' ${htop}/bin/htop - substituteInPlace autoload/health/openscad_nvim.vim --replace '@htop-path@' ${htop}/bin/htop - substituteInPlace lua/openscad.lua --replace '@openscad-path@' ${openscad}/bin/openscad - ''; + patches = [ + (substituteAll { + src = ./patches/openscad.nvim/program_paths.patch; + htop = lib.getExe htop; + openscad = lib.getExe openscad; + zathura = lib.getExe zathura; + }) + ]; }); orgmode = super.orgmode.overrideAttrs (old: { diff --git a/pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch b/pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch index 9bfcee2e34a4..c6b63682b2a0 100644 --- a/pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch +++ b/pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch @@ -7,7 +7,7 @@ index 9022d55..30ef53f 100644 function! s:check_zathura_installed() abort - if !executable('zathura') -+ if !executable('@zathura-path@') ++ if !executable('@zathura@') call health#report_error('has(zathura)','install zathura') else call health#report_ok("zathura is installed") @@ -16,7 +16,7 @@ index 9022d55..30ef53f 100644 function! s:check_htop_installed() abort - if !executable('htop') -+ if !executable('@htop-path@') ++ if !executable('@htop@') call health#report_error('has(htop)','install htop') else call health#report_ok("htop is installed") @@ -29,16 +29,16 @@ index 7dff2fb..4382003 100644 function M.manual() local path = U.openscad_nvim_root_dir .. U.path_sep .. "help_source" .. U.path_sep .. "openscad-manual.pdf" - api.nvim_command('silent !zathura --fork ' .. path) -+ api.nvim_command('silent !@zathura-path@ --fork ' .. path) ++ api.nvim_command('silent !@zathura@ --fork ' .. path) end function M.help() -@@ -119,7 +119,7 @@ end +@@ -125,7 +125,7 @@ function M.exec_openscad() + jobCommand = '/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD ' .. vim.fn.expand('%:p') + else + -- TODO: What about Windows? +- jobCommand = 'openscad ' .. vim.fn.expand('%:p') ++ jobCommand = '@oepnscad@ ' .. vim.fn.expand('%:p') + end - function M.exec_openscad() - -- maybe just use api.jobstart .. instead -- api.nvim_command[[ call jobstart('openscad ' . shellescape(expand('%:p')), {'detach':1}) ]] -+ api.nvim_command[[ call jobstart('@openscad-path@ ' . shellescape(expand('%:p')), {'detach':1}) ]] - end - - function M.default_mappings() + vim.fn.jobstart(jobCommand)