2023-03-30 02:54:57 +02:00
|
|
|
{ pkgs, lib, config, paths, inputs, ... }:
|
2023-01-10 02:38:06 +01:00
|
|
|
let
|
2023-03-16 22:22:06 +01:00
|
|
|
# {{{ extraPackages
|
2023-01-10 02:38:06 +01:00
|
|
|
extraPackages = with pkgs; [
|
|
|
|
# Language servers
|
|
|
|
nodePackages.typescript-language-server # typescript
|
|
|
|
nodePackages_latest.purescript-language-server # purescript
|
2023-03-30 02:54:57 +02:00
|
|
|
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.lua-language-server # lua
|
2023-01-10 02:38:06 +01:00
|
|
|
rnix-lsp # nix
|
2023-04-13 19:06:57 +02:00
|
|
|
nil # nix
|
2023-01-10 02:38:06 +01:00
|
|
|
haskell-language-server # haskell
|
2023-04-13 19:06:57 +02:00
|
|
|
dhall-lsp-server # dhall
|
2023-01-10 02:38:06 +01:00
|
|
|
tectonic # something related to latex (?)
|
|
|
|
texlab # latex
|
2023-03-30 02:54:57 +02:00
|
|
|
nodePackages_latest.vscode-langservers-extracted # Web stuff
|
|
|
|
python310Packages.python-lsp-server # Python
|
|
|
|
pyright # Python
|
2023-04-08 06:20:53 +02:00
|
|
|
rust-analyzer # rust
|
2023-01-10 02:38:06 +01:00
|
|
|
|
|
|
|
# Formatters
|
|
|
|
luaformatter # Lua
|
|
|
|
stylua # Lua
|
|
|
|
ormolu # Haskell
|
2023-03-30 02:54:57 +02:00
|
|
|
black # Python
|
|
|
|
yapf # Python
|
|
|
|
isort # Reorder python imports
|
2023-01-10 02:38:06 +01:00
|
|
|
nodePackages_latest.purs-tidy # Purescript
|
2023-02-02 01:33:12 +01:00
|
|
|
nodePackages_latest.prettier # Js & friends
|
2023-01-10 02:38:06 +01:00
|
|
|
nodePackages_latest.prettier_d_slim # Js & friends
|
|
|
|
|
2023-03-30 02:54:57 +02:00
|
|
|
# Linters
|
|
|
|
ruff # Python linter
|
|
|
|
mypy # Python typechecking
|
|
|
|
|
|
|
|
# Languages
|
2023-01-10 02:38:06 +01:00
|
|
|
nodePackages.typescript # typescript
|
2023-03-30 02:54:57 +02:00
|
|
|
lua # For repls and whatnot
|
2023-01-10 02:38:06 +01:00
|
|
|
wakatime # time tracking
|
2023-04-08 06:20:53 +02:00
|
|
|
rustfmt
|
2023-03-30 02:54:57 +02:00
|
|
|
|
|
|
|
# Others
|
2023-01-10 02:38:06 +01:00
|
|
|
fd # file finder
|
|
|
|
ripgrep # Grep rewrite
|
|
|
|
update-nix-fetchgit # Useful for nix stuff
|
|
|
|
tree-sitter # Syntax highlighting
|
|
|
|
libstdcxx5 # Required by treesitter aparently
|
2023-03-30 02:54:57 +02:00
|
|
|
python310Packages.jupytext # Convert between jupyter notebooks and python files
|
|
|
|
|
|
|
|
# Preview
|
2023-01-10 02:38:06 +01:00
|
|
|
zathura # Pdf reader
|
|
|
|
xdotool # For zathura reverse search or whatever it's called
|
|
|
|
glow #Mmd preview in terminal
|
|
|
|
pandoc # Md processing
|
|
|
|
libsForQt5.falkon # Aparently needed for md preview
|
|
|
|
|
|
|
|
texlive.combined.scheme-full # Latex stuff
|
|
|
|
python38Packages.pygments # required for latex syntax highlighting
|
2023-02-19 02:41:22 +01:00
|
|
|
|
2023-03-30 02:54:57 +02:00
|
|
|
# required for the telescope fzf extension
|
|
|
|
gnumake
|
|
|
|
cmake
|
|
|
|
gcc
|
|
|
|
|
2023-02-19 02:41:22 +01:00
|
|
|
# Required by magma-nvim:
|
|
|
|
# python310Packages.pynvim
|
|
|
|
# python310Packages.jupyter
|
2023-01-10 02:38:06 +01:00
|
|
|
];
|
2023-03-16 22:22:06 +01:00
|
|
|
# }}}
|
|
|
|
# {{{ extraRuntime
|
2023-01-22 01:22:38 +01:00
|
|
|
extraRuntime = env: [
|
|
|
|
# Snippets
|
2023-04-01 21:29:47 +02:00
|
|
|
(config.satellite.dev.path "dotfiles/vscode-snippets")
|
2023-01-22 01:22:38 +01:00
|
|
|
|
|
|
|
# Base16 theme
|
|
|
|
(pkgs.writeTextDir
|
|
|
|
"lua/nix/theme.lua"
|
2023-04-01 21:29:47 +02:00
|
|
|
config.satellite.colorscheme.lua
|
|
|
|
)
|
2023-01-22 01:22:38 +01:00
|
|
|
|
|
|
|
# Provide hints as to what app we are in
|
|
|
|
# (Useful because neovide does not provide the info itself right away)
|
|
|
|
(pkgs.writeTextDir
|
|
|
|
"lua/nix/env.lua"
|
|
|
|
"return '${env}'"
|
|
|
|
)
|
2023-01-10 02:38:06 +01:00
|
|
|
];
|
2023-03-16 22:22:06 +01:00
|
|
|
# }}}
|
|
|
|
# {{{ Client wrapper
|
2023-01-10 02:38:06 +01:00
|
|
|
# Wraps a neovim client, providing the dependencies
|
|
|
|
# and setting some flags:
|
|
|
|
#
|
|
|
|
# - NVIM_EXTRA_RUNTIME provides extra directories to add to the runtimepath.
|
|
|
|
# I cannot just install those dirs using the builtin package support because
|
|
|
|
# my package manager (lazy.nvim) disables those.
|
2023-03-16 22:22:06 +01:00
|
|
|
wrapClient = { base, name, binName ? name, extraArgs ? "" }:
|
2023-01-10 02:38:06 +01:00
|
|
|
pkgs.symlinkJoin {
|
|
|
|
inherit (base) name meta;
|
|
|
|
paths = [ base ];
|
|
|
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
|
|
|
postBuild = ''
|
2023-03-16 22:22:06 +01:00
|
|
|
wrapProgram $out/bin/${binName} \
|
2023-01-10 02:38:06 +01:00
|
|
|
--prefix PATH : ${lib.makeBinPath extraPackages} \
|
2023-01-22 01:22:38 +01:00
|
|
|
--set NVIM_EXTRA_RUNTIME ${lib.strings.concatStringsSep "," (extraRuntime name)} \
|
2023-01-12 20:49:08 +01:00
|
|
|
${extraArgs}
|
2023-01-10 02:38:06 +01:00
|
|
|
'';
|
|
|
|
};
|
2023-03-16 22:22:06 +01:00
|
|
|
# }}}
|
|
|
|
# {{{ Clients
|
2023-03-20 20:02:01 +01:00
|
|
|
neovim = wrapClient { base = pkgs.neovim; name = "nvim"; };
|
2023-03-16 22:22:06 +01:00
|
|
|
|
2023-01-12 20:49:08 +01:00
|
|
|
neovide = wrapClient {
|
|
|
|
base = pkgs.neovide;
|
|
|
|
name = "neovide";
|
|
|
|
extraArgs = "--set NEOVIDE_MULTIGRID true";
|
|
|
|
};
|
2023-03-16 22:22:06 +01:00
|
|
|
|
|
|
|
firenvim = wrapClient {
|
2023-03-20 20:02:01 +01:00
|
|
|
base = pkgs.neovim;
|
2023-03-16 22:22:06 +01:00
|
|
|
name = "firenvim";
|
|
|
|
binName = "nvim";
|
|
|
|
extraArgs = "--set GIT_DISCOVERY_ACROSS_FILESYSTEM 1";
|
|
|
|
};
|
|
|
|
# }}}
|
2023-01-10 02:38:06 +01:00
|
|
|
in
|
|
|
|
{
|
2023-03-16 22:22:06 +01:00
|
|
|
# {{{ Basic config
|
2023-01-10 02:38:06 +01:00
|
|
|
# Do not manage neovim via nix
|
|
|
|
programs.neovim.enable = false;
|
|
|
|
|
2023-04-01 21:29:47 +02:00
|
|
|
xdg.configFile.nvim.source = config.satellite.dev.path "dotfiles/neovim";
|
2023-01-12 20:49:08 +01:00
|
|
|
home.sessionVariables.EDITOR = "nvim";
|
|
|
|
|
2023-01-10 02:38:06 +01:00
|
|
|
home.packages = [
|
|
|
|
neovim
|
|
|
|
neovide
|
|
|
|
];
|
2023-03-16 22:22:06 +01:00
|
|
|
# }}}
|
|
|
|
# {{{ Firenvim
|
|
|
|
home.file.".mozilla/native-messaging-hosts/firenvim.json".text =
|
|
|
|
let
|
|
|
|
# God knows what this does
|
|
|
|
# https://github.com/glacambre/firenvim/blob/87c9f70d3e6aa2790982aafef3c696dbe962d35b/autoload/firenvim.vim#L592
|
|
|
|
firenvim_init = pkgs.writeText "firenvim_init.vim" ''
|
|
|
|
let g:firenvim_i=[]
|
|
|
|
let g:firenvim_o=[]
|
|
|
|
let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}
|
|
|
|
let g:Firenvim_oo={t->[chansend(2,t)]+add(g:firenvim_o,t)}
|
|
|
|
let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})
|
|
|
|
let g:started_by_firenvim = v:true
|
|
|
|
'';
|
|
|
|
|
|
|
|
firenvim_file_loaded = pkgs.writeText "firenvim_file_loaded.vim"
|
|
|
|
''
|
|
|
|
try
|
|
|
|
call firenvim#run()
|
|
|
|
catch /Unknown function/
|
|
|
|
call chansend(g:firenvim_c,["f\n\n\n"..json_encode({"messages":["Your plugin manager did not load the Firenvim plugin for neovim."],"version":"0.0.0"})])
|
|
|
|
call chansend(2,["Firenvim not in runtime path. &rtp="..&rtp])
|
|
|
|
qall!
|
|
|
|
catch
|
|
|
|
call chansend(g:firenvim_c,["l\n\n\n"..json_encode({"messages": ["Something went wrong when running firenvim. See troubleshooting guide."],"version":"0.0.0"})])
|
|
|
|
call chansend(2,[v:exception])
|
|
|
|
qall!
|
|
|
|
endtry
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
builtins.toJSON
|
|
|
|
{
|
|
|
|
name = "firenvim";
|
|
|
|
description = "Turn your browser into a Neovim GUI.";
|
|
|
|
type = "stdio";
|
|
|
|
allowed_extensions = [ "firenvim@lacamb.re" ];
|
|
|
|
path = pkgs.writeShellScript "firenvim.sh" ''
|
|
|
|
mkdir -p /run/user/$UID/firenvim
|
|
|
|
chmod 700 /run/user/$UID/firenvim
|
|
|
|
cd /run/user/$UID/firenvim
|
|
|
|
|
|
|
|
exec '${firenvim}/bin/nvim' --headless \
|
|
|
|
--cmd 'source "${firenvim_init}"' \
|
|
|
|
-S '${firenvim_file_loaded}'
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
# }}}
|
2023-01-10 02:38:06 +01:00
|
|
|
}
|