Skip to content

Commit

Permalink
feat(nvim): setup for ipynb dev work
Browse files Browse the repository at this point in the history
Setup:
- molten (run python code)
- otter (lsp in markdown codeblocks)
- jupytext (convert .ipynb files to .md files transparently)
- image (display images inside neovim (e.g. matplotlib graphs))
  • Loading branch information
jalil-salame committed Oct 12, 2024
1 parent 4f74794 commit f30afe5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 21 deletions.
20 changes: 9 additions & 11 deletions flake-modules/nvim.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{ inputs, ... }:
let
standalone = ../nvim/standalone.nix;
in
{
flake.overlays.nixvim = inputs.nixvim.overlays.default;

perSystem =
{ pkgs, system, ... }:
{
# Check standalone nvim build
checks.nvim = inputs.nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
let
nixvimLib = inputs.nixvim.lib.${system};
nixvim = inputs.nixvim.legacyPackages.${system};
module = {
inherit pkgs;
module = ../nvim/standalone.nix;
};
in
{
# Check standalone nvim build
checks.nvim = nixvimLib.check.mkTestDerivationFromNixvimModule module;

# Nvim standalone module
packages.nvim = inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule {
inherit pkgs;
module = standalone;
};

packages.nvim = nixvim.makeNixvimWithModule module;
};
}
22 changes: 21 additions & 1 deletion nvim/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
...
}:
let
inherit (helpers) mkRaw;
inherit (helpers) mkRaw enableExceptInTests;
in
{
config.plugins = {
Expand Down Expand Up @@ -160,6 +160,15 @@ in
};
};
gitsigns.enable = true;
image.enable = enableExceptInTests;
jupytext = {
enable = true;
settings.custom_language_formatting.python = {
extension = "md";
style = "markdown";
force_ft = "markdown";
};
};
lint = {
enable = true;
lintersByFt = {
Expand Down Expand Up @@ -210,6 +219,15 @@ in
enable = true;
settings.update_events = "TextChanged,TextChangedI";
};
molten = {
enable = true;
settings = {
image_provider = "image.nvim";
virt_text_output = true;
molten_auto_open_output = false;
molten_virt_lines_off_by_1 = true;
};
};
noice = {
enable = true;
lsp.override = {
Expand Down Expand Up @@ -241,6 +259,7 @@ in
mode = "virtualtext";
};
};
otter.enable = true;
rustaceanvim = {
enable = true;
# Install through rustup
Expand All @@ -256,6 +275,7 @@ in
treesitter = {
enable = true;
settings = {
highlight.enable = true;
indent.enable = true;
incremental_election.enable = true;
};
Expand Down
1 change: 1 addition & 0 deletions nvim/standalone.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
pkgs.unstable.taplo
pkgs.unstable.typos
pkgs.unstable.yamlfmt
(pkgs.unstable.python3.withPackages (p: [ p.jupytext ]))
];
extraConfigLuaPre =
# lua
Expand Down
20 changes: 11 additions & 9 deletions system/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,17 @@ in
};

environment.etc = keysFromGithub;
services.openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") (
builtins.attrNames keysFromGithub
);

# Enable printer autodiscovery if printing is enabled
services.avahi = {
inherit (config.services.printing) enable;
nssmdns4 = true;
openFirewall = true;
services = {
# Enable printer autodiscovery if printing is enabled
avahi = {
inherit (config.services.printing) enable;
nssmdns4 = true;
openFirewall = true;
};
openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") (
builtins.attrNames keysFromGithub
);
jupyter.enable = cfg.dev.enable;
};
users.defaultUserShell = pkgs.zsh;
# Open ports for spotifyd
Expand Down

0 comments on commit f30afe5

Please sign in to comment.