From 63f6aa75be2da364e5c883d50be56754bcd5103f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Wed, 9 Oct 2024 03:05:03 +0200 Subject: [PATCH 1/7] [chore] flake.lock: update inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/6e6b3dd395c3b1eb9be9f2d096383a8d05add030' (2024-10-04) → 'github:NixOS/nixpkgs/1bfbbbe5bbf888d675397c66bfdb275d0b99361c' (2024-10-07) • Updated input 'nixvim': 'github:nix-community/nixvim/6594472fd275f6dcf5a9fba4a83d2f7fa2cf2b8a' (2024-10-05) → 'github:nix-community/nixvim/eda14029813906b1ef355823de237d86fea59908' (2024-10-08) • Updated input 'unstable': 'github:NixOS/nixpkgs/bc947f541ae55e999ffdb4013441347d83b00feb' (2024-10-04) → 'github:NixOS/nixpkgs/c31898adf5a8ed202ce5bea9f347b1c6871f32d1' (2024-10-06) --- flake.lock | 18 +++++++++--------- nvim/plugins.nix | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 2de6960..caa449d 100644 --- a/flake.lock +++ b/flake.lock @@ -260,11 +260,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1728067476, - "narHash": "sha256-/uJcVXuBt+VFCPQIX+4YnYrHaubJSx4HoNsJVNRgANM=", + "lastModified": 1728328465, + "narHash": "sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6e6b3dd395c3b1eb9be9f2d096383a8d05add030", + "rev": "1bfbbbe5bbf888d675397c66bfdb275d0b99361c", "type": "github" }, "original": { @@ -292,11 +292,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1728145679, - "narHash": "sha256-qd1nr2b+WUiyzJva650LBX/3hDBru0ZSVxKHSm1BE0w=", + "lastModified": 1728428263, + "narHash": "sha256-TG/ojDMLuLJI4nEo0waZawgAq4r30n7xJ8klEKpFcd0=", "owner": "nix-community", "repo": "nixvim", - "rev": "6594472fd275f6dcf5a9fba4a83d2f7fa2cf2b8a", + "rev": "eda14029813906b1ef355823de237d86fea59908", "type": "github" }, "original": { @@ -388,11 +388,11 @@ }, "unstable": { "locked": { - "lastModified": 1728018373, - "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=", + "lastModified": 1728241625, + "narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bc947f541ae55e999ffdb4013441347d83b00feb", + "rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1", "type": "github" }, "original": { diff --git a/nvim/plugins.nix b/nvim/plugins.nix index 9db807f..fa887c2 100644 --- a/nvim/plugins.nix +++ b/nvim/plugins.nix @@ -184,7 +184,7 @@ in jsonls.enable = true; marksman.enable = true; nixd.enable = true; - nil-ls = { + nil_ls = { enable = true; settings.nix.flake = { autoArchive = true; @@ -196,8 +196,8 @@ in ruff.enable = true; taplo.enable = true; # texlab.enable = true; # Not writing TeX rn - typos-lsp.enable = true; - typst-lsp.enable = true; + typos_lsp.enable = true; + # typst_lsp.enable = true; # Not using it either }; }; lspkind = { From 9f59290f50b31ec613084217119084afe4ecd2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Wed, 9 Oct 2024 09:03:22 +0200 Subject: [PATCH 2/7] fix(nvim): clean up some old configuration stuff - Remove `typos` from `plugins.lints` (we already use `typos_lsp`) - Comment out unused lsp servers. They are big and we don't want to increase the closure/package size too much. --- nvim/plugins.nix | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/nvim/plugins.nix b/nvim/plugins.nix index fa887c2..4a85f8e 100644 --- a/nvim/plugins.nix +++ b/nvim/plugins.nix @@ -163,12 +163,7 @@ in lint = { enable = true; lintersByFt = { - rust = [ "typos" ]; - latex = [ - "chktex" - "typos" - ]; - markdown = [ "typos" ]; + latex = [ "chktex" ]; nix = [ "statix" ]; sh = [ "dash" ]; zsh = [ "zsh" ]; @@ -177,10 +172,12 @@ in lsp = { enable = true; servers = { - bashls.enable = true; - bashls.package = pkgs.unstable.bash-language-server; + bashls = { + enable = true; + package = pkgs.unstable.bash-language-server; + }; # clangd.enable = true; # Adds ~2GiB - html.enable = true; + # html.enable = true; # Not writing html jsonls.enable = true; marksman.enable = true; nixd.enable = true; @@ -192,7 +189,6 @@ in }; }; pyright.enable = true; - # ruff-lsp.enable = true; ruff.enable = true; taplo.enable = true; # texlab.enable = true; # Not writing TeX rn From 4ae1433fced6fda6234694b9b6f984607c6787d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Thu, 10 Oct 2024 03:03:22 +0200 Subject: [PATCH 3/7] [chore] flake.lock: update inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixvim': 'github:nix-community/nixvim/eda14029813906b1ef355823de237d86fea59908' (2024-10-08) → 'github:nix-community/nixvim/61ec39764fbe1e4f21cf801ea7b9209d527c8135' (2024-10-09) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index caa449d..8837cac 100644 --- a/flake.lock +++ b/flake.lock @@ -292,11 +292,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1728428263, - "narHash": "sha256-TG/ojDMLuLJI4nEo0waZawgAq4r30n7xJ8klEKpFcd0=", + "lastModified": 1728485062, + "narHash": "sha256-+2e9hAM2GVDF3gywdQI/OA7s4f0Z9rvFuiVxePI41QM=", "owner": "nix-community", "repo": "nixvim", - "rev": "eda14029813906b1ef355823de237d86fea59908", + "rev": "61ec39764fbe1e4f21cf801ea7b9209d527c8135", "type": "github" }, "original": { From 63b1e0e8cc98fc2fe71e686555879433736e359e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Fri, 11 Oct 2024 03:04:55 +0200 Subject: [PATCH 4/7] [chore] flake.lock: update inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/1bfbbbe5bbf888d675397c66bfdb275d0b99361c' (2024-10-07) → 'github:NixOS/nixpkgs/d51c28603def282a24fa034bcb007e2bcb5b5dd0' (2024-10-09) • Updated input 'nixvim': 'github:nix-community/nixvim/61ec39764fbe1e4f21cf801ea7b9209d527c8135' (2024-10-09) → 'github:nix-community/nixvim/af650ba9401501352d6eaaced192bbb4abfaec87' (2024-10-10) • Updated input 'unstable': 'github:NixOS/nixpkgs/c31898adf5a8ed202ce5bea9f347b1c6871f32d1' (2024-10-06) → 'github:NixOS/nixpkgs/5633bcff0c6162b9e4b5f1264264611e950c8ec7' (2024-10-09) --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 8837cac..7dd8f7d 100644 --- a/flake.lock +++ b/flake.lock @@ -260,11 +260,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1728328465, - "narHash": "sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo=", + "lastModified": 1728500571, + "narHash": "sha256-dOymOQ3AfNI4Z337yEwHGohrVQb4yPODCW9MDUyAc4w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1bfbbbe5bbf888d675397c66bfdb275d0b99361c", + "rev": "d51c28603def282a24fa034bcb007e2bcb5b5dd0", "type": "github" }, "original": { @@ -292,11 +292,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1728485062, - "narHash": "sha256-+2e9hAM2GVDF3gywdQI/OA7s4f0Z9rvFuiVxePI41QM=", + "lastModified": 1728593423, + "narHash": "sha256-xM3+7mvWwM5i+RXD97wQ/fSoQDFidVxNszIfKIv9msE=", "owner": "nix-community", "repo": "nixvim", - "rev": "61ec39764fbe1e4f21cf801ea7b9209d527c8135", + "rev": "af650ba9401501352d6eaaced192bbb4abfaec87", "type": "github" }, "original": { @@ -388,11 +388,11 @@ }, "unstable": { "locked": { - "lastModified": 1728241625, - "narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=", + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", "type": "github" }, "original": { From 9765b6142a9ff3ab90103223babca3782c45cd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 12 Oct 2024 03:03:36 +0200 Subject: [PATCH 5/7] [chore] flake.lock: update inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixvim': 'github:nix-community/nixvim/af650ba9401501352d6eaaced192bbb4abfaec87' (2024-10-10) → 'github:nix-community/nixvim/5cd8c9cf3104027b42ffe531fb68463ecb08ebc9' (2024-10-10) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 7dd8f7d..ce900c9 100644 --- a/flake.lock +++ b/flake.lock @@ -292,11 +292,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1728593423, - "narHash": "sha256-xM3+7mvWwM5i+RXD97wQ/fSoQDFidVxNszIfKIv9msE=", + "lastModified": 1728603032, + "narHash": "sha256-RAKCcBXqF/xOaf7fR11dnIZwZ8SDyNcK3MyVgD0l1xQ=", "owner": "nix-community", "repo": "nixvim", - "rev": "af650ba9401501352d6eaaced192bbb4abfaec87", + "rev": "5cd8c9cf3104027b42ffe531fb68463ecb08ebc9", "type": "github" }, "original": { From 4f7479490efa8dc53f07eee2b217389adaf7da4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 12 Oct 2024 19:30:44 +0200 Subject: [PATCH 6/7] feat(envrc): fetch repo on enter Should help me not to work on an outdated commit, thankfully jj makes it trivial to rebase. --- .envrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.envrc b/.envrc index 3550a30..5849ead 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,10 @@ +# update repo +if has jj; then + jj git fetch +elif has gix; then + gix fetch +elif has git; then + git fetch +fi + use flake From f30afe506b4da8e9ad8e6b3d7a8d86409fdf2d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 5 Oct 2024 22:37:58 +0200 Subject: [PATCH 7/7] feat(nvim): setup for ipynb dev work 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)) --- flake-modules/nvim.nix | 20 +++++++++----------- nvim/plugins.nix | 22 +++++++++++++++++++++- nvim/standalone.nix | 1 + system/default.nix | 20 +++++++++++--------- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/flake-modules/nvim.nix b/flake-modules/nvim.nix index 95280ef..a143ff1 100644 --- a/flake-modules/nvim.nix +++ b/flake-modules/nvim.nix @@ -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; }; } diff --git a/nvim/plugins.nix b/nvim/plugins.nix index 4a85f8e..3c2f67d 100644 --- a/nvim/plugins.nix +++ b/nvim/plugins.nix @@ -5,7 +5,7 @@ ... }: let - inherit (helpers) mkRaw; + inherit (helpers) mkRaw enableExceptInTests; in { config.plugins = { @@ -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 = { @@ -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 = { @@ -241,6 +259,7 @@ in mode = "virtualtext"; }; }; + otter.enable = true; rustaceanvim = { enable = true; # Install through rustup @@ -256,6 +275,7 @@ in treesitter = { enable = true; settings = { + highlight.enable = true; indent.enable = true; incremental_election.enable = true; }; diff --git a/nvim/standalone.nix b/nvim/standalone.nix index 155d91b..b5f13e8 100644 --- a/nvim/standalone.nix +++ b/nvim/standalone.nix @@ -61,6 +61,7 @@ pkgs.unstable.taplo pkgs.unstable.typos pkgs.unstable.yamlfmt + (pkgs.unstable.python3.withPackages (p: [ p.jupytext ])) ]; extraConfigLuaPre = # lua diff --git a/system/default.nix b/system/default.nix index 9d168a1..a3c2347 100644 --- a/system/default.nix +++ b/system/default.nix @@ -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