modules.packages.vscode: use nix4vscode instead of nix-vscode-extensions

This commit is contained in:
2025-08-17 14:09:07 +08:00
parent 66111e1dec
commit 70caf942de
4 changed files with 338 additions and 113 deletions

48
flake.lock generated
View File

@@ -325,7 +325,7 @@
},
"flake-utils": {
"inputs": {
"systems": "systems"
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
@@ -342,24 +342,6 @@
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
@@ -377,7 +359,7 @@
"type": "github"
}
},
"flake-utils_4": {
"flake-utils_3": {
"inputs": {
"systems": "systems_4"
},
@@ -695,25 +677,24 @@
"type": "github"
}
},
"nix-vscode-extensions": {
"nix4vscode": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
],
"systems": "systems"
},
"locked": {
"lastModified": 1747382874,
"narHash": "sha256-VCFqktsjKsz5eJOCdX2mM3Uytbb7Et6MHshEpCpuWFk=",
"lastModified": 1755396695,
"narHash": "sha256-kXrOSKkkbqniqRX6VB2agcrEdPyk1wz9lG5qXq1Qllk=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "4a7f92bdabb365936a8e8958948536cc2ceac7ba",
"repo": "nix4vscode",
"rev": "4cb97e36b762ef5517fb7b974dd819dfbca3c1e3",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "4a7f92bdabb365936a8e8958948536cc2ceac7ba",
"repo": "nix-vscode-extensions",
"repo": "nix4vscode",
"type": "github"
}
},
@@ -935,7 +916,7 @@
"devshell": "devshell",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils",
"nixos-stable": "nixos-stable",
"nixpkgs": [
"nixpkgs"
@@ -1016,7 +997,7 @@
"nvfetcher_2": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nur-xddxdd",
"nixpkgs"
@@ -1171,7 +1152,7 @@
"niri": "niri",
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",
"nix4vscode": "nix4vscode",
"nixos-wallpaper": "nixos-wallpaper",
"nixpkgs": "nixpkgs_2",
"nixpkgs-2305": "nixpkgs-2305",
@@ -1321,6 +1302,7 @@
}
},
"systems": {
"flake": false,
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@@ -1492,7 +1474,7 @@
"winapps": {
"inputs": {
"flake-compat": "flake-compat_5",
"flake-utils": "flake-utils_4",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
]

View File

@@ -12,11 +12,6 @@
sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
nix-index-database = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; };
nur-xddxdd = { url = "github:xddxdd/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
nix-vscode-extensions =
{
url = "github:nix-community/nix-vscode-extensions?ref=4a7f92bdabb365936a8e8958948536cc2ceac7ba";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:CHN-beta/impermanence";
plasma-manager =
{
@@ -32,6 +27,7 @@
nixvirt = { url = "github:CHN-beta/NixVirt"; inputs.nixpkgs.follows = "nixpkgs"; };
buildproxy = { url = "github:polygon/nix-buildproxy"; inputs.nixpkgs.follows = "nixpkgs"; };
niri.url = "github:sodiboo/niri-flake";
nix4vscode = { url = "github:nix-community/nix4vscode"; inputs.nixpkgs.follows = "nixpkgs"; };
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };

View File

@@ -39,11 +39,10 @@ in platformConfig //
[
inputs.topInputs.aagl.overlays.default
inputs.topInputs.nur-xddxdd.overlays.inSubTree
inputs.topInputs.nix-vscode-extensions.overlays.default
inputs.topInputs.buildproxy.overlays.default
inputs.topInputs.nix4vscode.overlays.default
(final: prev:
{
inherit (inputs.topInputs.nix-vscode-extensions.overlays.default final prev) nix-vscode-extensions;
nur-linyinfeng = (inputs.topInputs.nur-linyinfeng.overlays.default final prev).linyinfeng;
firefox-addons = (import "${inputs.topInputs.rycee}" { inherit (prev) pkgs; }).firefox-addons;
})

View File

@@ -7,80 +7,328 @@ inputs:
};
config = let inherit (inputs.config.nixos.packages) vscode; in inputs.lib.mkIf (vscode != null)
{
nixos.packages.packages = with inputs.pkgs;
{
_packages =
[(
vscode-with-extensions.override
nixos.user.sharedModules =
[(hmInputs: {
config.programs.vscode = inputs.lib.mkIf (hmInputs.config.home.username != "root")
{
enable = true;
package = inputs.pkgs.vscode.overrideAttrs (prev: { preFixup = prev.preFixup +
''
gappsWrapperArgs+=(
${builtins.concatStringsSep " " inputs.config.nixos.packages.packages._vscodeEnvFlags}
)
'';});
profiles.default =
{
vscodeExtensions =
let extensions = builtins.listToAttrs (builtins.map
(set:
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
extensions = inputs.pkgs.nix4vscode.forVscode
[
"github.copilot" "github.copilot-chat" "github.github-vscode-theme"
"intellsmi.comment-translate"
"ms-vscode.cmake-tools" "ms-vscode.cpptools-extension-pack" "ms-vscode.hexeditor"
"ms-vscode.remote-explorer"
"ms-vscode-remote.remote-ssh"
"donjayamanne.githistory" "fabiospampinato.vscode-diff"
"llvm-vs-code-extensions.vscode-clangd" "ms-ceintl.vscode-language-pack-zh-hans"
"oderwat.indent-rainbow"
"twxs.cmake" "guyutongxue.cpp-reference" "thfriedrich.lammps" "leetcode.vscode-leetcode" # "znck.grammarly"
"james-yu.latex-workshop" "bbenoist.nix" "jnoortheen.nix-ide" "ccls-project.ccls"
"brettm12345.nixfmt-vscode"
"gruntfuggly.todo-tree"
# restrctured text
"lextudio.restructuredtext" "trond-snekvik.simple-rst" "swyddfa.esbonio" "chrisjsewell.myst-tml-syntax"
# markdown
"yzhang.markdown-all-in-one" "shd101wyy.markdown-preview-enhanced"
# vasp
"mystery.vasp-support"
"yutengjing.open-in-external-app"
# git graph
"mhutchie.git-graph"
# python
"ms-python.python"
# theme
"pkief.material-icon-theme"
# direnv
"mkhl.direnv"
# svg viewer
"vitaliymaz.vscode-svg-previewer"
# draw
"pomdtr.excalidraw-editor"
# typst
"myriad-dreamin.tinymist"
# grammaly alternative
"ltex-plus.vscode-ltex-plus"
# jupyter
"ms-toolsai.jupyter" "ms-toolsai.jupyter-keymap" "ms-toolsai.jupyter-renderers"
"ms-toolsai.vscode-jupyter-cell-tags" "ms-toolsai.vscode-jupyter-slideshow"
"ms-toolsai.datawrangler"
];
keybindings =
[
# use alt+a to complete inline suggestions, instead of tab or ctrl+enter
{
key = "alt+a";
command = "editor.action.inlineSuggest.commit";
when = "inlineSuggestionVisible";
}
{
key = "tab";
command = "-editor.action.inlineSuggest.commit";
}
{
key = "ctrl+enter";
command = "-editor.action.inlineSuggest.commit";
}
# use ctrl+j to jump to pdf in latex
{
key = "ctrl+alt+j";
command = "-latex-workshop.synctex";
}
{
key = "ctrl+j";
command = "-workbench.action.togglePanel";
}
{
key = "ctrl+j";
command = "latex-workshop.synctex";
when = "editorTextFocus && editorLangId == 'latex'";
}
{
key = "ctrl+l alt+j";
command = "-latex-workshop.synctex";
}
# use ctrl+j=b to build latex
{
key = "ctrl+b";
command = "-workbench.action.toggleSidebarVisibility";
}
{
key = "ctrl+b";
command = "latex-workshop.build";
when = "editorLangId =~ /^latex$|^latex-expl3$|^rsweave$|^jlweave$|^pweave$/";
}
{
key = "ctrl+l alt+b";
command = "-latex-workshop.build";
}
# use alt+t to cd to current dir
{
key = "alt+t";
command = "workbench.action.terminal.sendSequence";
args.text = "cd '\${fileDirname}'\n";
}
];
userSettings =
{
"security.workspace.trust.enabled" = false;
"editor.fontFamily" = "'FiraCode Nerd Font Mono', 'Noto Sans Mono CJK SC', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'";
"editor.fontLigatures" = true;
"workbench.iconTheme" = "material-icon-theme";
"cmake.configureOnOpen" = true;
"editor.mouseWheelZoom" = true;
"extensions.ignoreRecommendations" = true;
"editor.smoothScrolling" = true;
"editor.cursorSmoothCaretAnimation" = "on";
"workbench.list.smoothScrolling" = true;
"files.hotExit" = "off";
"editor.wordWrapColumn" = 120;
"window.restoreWindows" = "none";
"editor.inlineSuggest.enabled" = true;
"github.copilot.enable"."*" = true;
"editor.acceptSuggestionOnEnter" = "off";
"terminal.integrated.scrollback" = 10000;
"editor.rulers" = [ 120 ];
"indentRainbow.ignoreErrorLanguages" = [ "*" ];
"markdown.extension.completion.respectVscodeSearchExclude" = false;
"markdown.extension.print.absoluteImgPath" = false;
"editor.tabCompletion" = "on";
"workbench.colorTheme" = "GitHub Light";
"workbench.startupEditor" = "none";
"debug.toolBarLocation" = "docked";
"search.maxResults" = 100000;
"editor.action.inlineSuggest.commit" = "Ctrl+Space";
"window.dialogStyle" = "custom";
"redhat.telemetry.enabled" = true;
"[xml]"."editor.defaultFormatter" = "DotJoshJohnson.xml";
"git.ignoreLegacyWarning" = true;
"git.confirmSync" = false;
"cmake.configureArgs" = [ "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" "-DCMAKE_EXPORT_COMPILE_COMMANDS=1" ];
"editor.wordWrap" = "wordWrapColumn";
"files.associations" = { "POSCAR" = "poscar"; "*.mod" = "lmps"; "*.vasp" = "poscar"; };
"editor.stickyScroll.enabled" = true;
"editor.minimap.showSlider" = "always";
"editor.unicodeHighlight.allowedLocales" = { "zh-hans" = true; "zh-hant" = true; };
"hexeditor.columnWidth" = 64;
"latex-workshop.synctex.afterBuild.enabled" = true;
"hexeditor.showDecodedText" = true;
"hexeditor.defaultEndianness" = "little";
"hexeditor.inspectorType" = "aside";
"commentTranslate.hover.concise" = true;
"commentTranslate.targetLanguage" = "en";
"[python]"."editor.formatOnType" = true;
"editor.minimap.renderCharacters" = false;
"update.mode" = "none";
"editor.tabSize" = 2;
"nix.enableLanguageServer" = true;
"nix.serverPath" = "nil";
"nix.formatterPath" = "nixpkgs-fmt";
"nix.serverSettings"."nil" =
{
"diagnostics"."ignored" = [ "unused_binding" "unused_with" ];
"formatting"."command" = [ "nixpkgs-fmt" ];
};
"xmake.envBehaviour" = "erase";
"git.openRepositoryInParentFolders" = "never";
"todo-tree.regex.regex" = "(//|#|<!--|;|/\\*|^|%|^[ \\t]*(-|\\d+.))\\s*($TAGS)";
"latex-workshop.latex.recipes" =
[
{
name = set;
value =
# provided by nixpkgs
vscode-extensions.${set} or {}
# provided by nix-vscode-extensions, including pre-release versions, but prefer stable version
// nix-vscode-extensions.vscode-marketplace.${set} or {}
// nix-vscode-extensions.vscode-marketplace-release.${set} or {}
# some versions are too high for the current vscode, use old version from here to override it
// (nix-vscode-extensions.forVSCodeVersion inputs.pkgs.vscode.version)
.vscode-marketplace-release.${set} or {};
})
(inputs.lib.unique
(
(builtins.attrNames vscode-extensions)
++ (builtins.attrNames nix-vscode-extensions.vscode-marketplace)
++ (builtins.attrNames nix-vscode-extensions.vscode-marketplace-release)
)));
in with extensions;
(with github; [ copilot copilot-chat github-vscode-theme ])
++ (with intellsmi; [ comment-translate ])
++ (with ms-vscode; [ cmake-tools cpptools-extension-pack hexeditor remote-explorer ])
++ (with ms-vscode-remote; [ remote-ssh ])
++ [
donjayamanne.githistory fabiospampinato.vscode-diff
llvm-vs-code-extensions.vscode-clangd ms-ceintl.vscode-language-pack-zh-hans
oderwat.indent-rainbow
twxs.cmake guyutongxue.cpp-reference thfriedrich.lammps leetcode.vscode-leetcode # znck.grammarly
james-yu.latex-workshop bbenoist.nix jnoortheen.nix-ide ccls-project.ccls
brettm12345.nixfmt-vscode
gruntfuggly.todo-tree
# restrctured text
lextudio.restructuredtext trond-snekvik.simple-rst swyddfa.esbonio chrisjsewell.myst-tml-syntax
# markdown
yzhang.markdown-all-in-one shd101wyy.markdown-preview-enhanced
# vasp
mystery.vasp-support
yutengjing.open-in-external-app
# git graph
mhutchie.git-graph
# python
ms-python.python
# theme
pkief.material-icon-theme
# direnv
mkhl.direnv
# svg viewer
vitaliymaz.vscode-svg-previewer
# draw
pomdtr.excalidraw-editor
# typst
myriad-dreamin.tinymist
# grammaly alternative
ltex-plus.vscode-ltex-plus
]
# jupyter
# TODO: pick all extensions from nixpkgs or nix-vscode-extensions, explicitly
++ (with vscode-extensions.ms-toolsai;
[
jupyter jupyter-keymap jupyter-renderers vscode-jupyter-cell-tags vscode-jupyter-slideshow
datawrangler
]);
extraFlags = builtins.concatStringsSep " " inputs.config.nixos.packages.packages._vscodeEnvFlags;
}
)];
};
name = "xelatex";
tools = [ "xelatex" "bibtex" "xelatex" "xelatex" ];
}
{
name = "latexmk";
tools = [ "latexmk" ];
}
{
name = "latexmk (latexmkrc)";
tools = [ "latexmk_rconly" ];
}
{
name = "latexmk (lualatex)";
tools = [ "lualatexmk" ];
}
{
name = "latexmk (xelatex)";
tools = [ "xelatexmk" ];
}
{
name = "pdflatex -> bibtex -> pdflatex * 2";
tools = [ "pdflatex" "bibtex" "pdflatex" "pdflatex" ];
}
];
"latex-workshop.latex.recipe.default" = "xelatex";
"latex-workshop.bind.altKeymap.enabled" = true;
"latex-workshop.latex.autoBuild.run" = "never";
"cmake.showOptionsMovedNotification" = false;
"markdown.extension.toc.plaintext" = true;
"markdown.extension.katex.macros" = {};
"markdown-preview-enhanced.mathRenderingOption" = "MathJax";
"mesonbuild.downloadLanguageServer" = false;
"genieai.openai.model" = "gpt-3.5-turbo-instruct";
"codeium.enableConfig" = { "*" = true; "Log" = true; };
"fortran.notifications.releaseNotes" = false;
"markdown-preview-enhanced.enablePreviewZenMode" = true;
"ccls.misc.compilationDatabaseDirectory" = "build";
"C_Cpp.intelliSenseEngine" = "disabled";
"clangd.arguments" = [ "-header-insertion=never" ];
"cmake.ctestDefaultArgs" = [ "-T" "test" "--output-on-failure" "--verbose" ];
"terminal.integrated.mouseWheelZoom" = true;
"notebook.lineNumbers" = "on";
"editor.codeActionsOnSave" = {};
"jupyter.notebookFileRoot" = "\${workspaceFolder}";
"svg.preview.transparencyGrid" = false;
"svg.preview.boundingBox" = false;
"latex-workshop.latex.tools" =
[
{
name = "xelatex";
command = "xelatex";
args = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOC%" ];
env = {};
}
{
name = "latexmk";
command = "latexmk";
args = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "-pdf" "-outdir=%OUTDIR%" "%DOC%" ];
env = {};
}
{
name = "lualatexmk";
command = "latexmk";
args =
[ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "-lualatex" "-outdir=%OUTDIR%" "%DOC%" ];
env = {};
}
{
name = "xelatexmk";
command = "latexmk";
args =
[ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "-xelatex" "-outdir=%OUTDIR%" "%DOC%" ];
env = {};
}
{
name = "latexmk_rconly";
command = "latexmk";
args = [ "%DOC%" ];
env = {};
}
{
name = "pdflatex";
command = "pdflatex";
args = [ "-synctex=1" "-interaction=nonstopmode" "-file-line-error" "%DOC%" ];
env = {};
}
{
name = "bibtex";
command = "bibtex";
args = [ "%DOCFILE%" ];
env = {};
}
{
name = "rnw2tex";
command = "Rscript";
args = [ "-e" "knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')" ];
env = {};
}
{
name = "jnw2tex";
command = "julia";
args = [ "-e" "using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")" ];
env = {};
}
{
name = "jnw2texminted";
command = "julia";
args = [ "-e" "using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")" ];
env = {};
}
{
name = "pnw2tex";
command = "pweave";
args = [ "-f" "tex" "%DOC_EXT%" ];
env = {};
}
{
name = "pnw2texminted";
command = "pweave";
args = [ "-f" "texminted" "%DOC_EXT%" ];
env = {};
}
{
name = "tectonic";
command = "tectonic";
args = [ "--synctex" "--keep-logs" "--print" "%DOC%.tex" ];
env = {};
}
];
"todo-tree.general.tags" = [ "BUG" "HACK" "FIXME" "TODO" ];
"ltex.additionalRules.motherTongue" = "zh-CN";
"ltex.ltex-ls.path" = "/run/current-system/sw";
"cmake.ignoreCMakeListsMissing" = true;
"[nix]"."editor.defaultFormatter" = "jnoortheen.nix-ide";
"todo-tree.filtering.excludedWorkspaces" = [ "/nix/remote/**" ];
"dataWrangler.outputRenderer.enabledTypes" =
{
"numpy.ndarray" = true;
"builtins.list" = true;
"builtins.dict" = true;
};
"ltex.language" = "auto";
};
};
};
})];
};
}