Nix re-packaging of prettier to enable plugins
- β¬οΈ Top of Document
- ποΈ Requirements
- β‘ Quick Start
- π§° Usage
- π Notes
- π Contributing
- π Attribution
- βοΈ Licensing
Install the NixOS and/or Nix package manager via official instructions;
https://nixos.org/nixos/manual/
Clone this project...
Linux/MacOS
mkdir -vp ~/git/hub/nix-utilities
cd ~/git/hub/nix-utilities
git clone [email protected]:nix-utilities/prettier-with-plugins.git
home.nix(snippet)
{ config, pkgs, lib, ... }:
let
prettier-with-plugins = import /home/USER/git/hub/nix-utilities/prettier-with-plugins {
inherit lib pkgs;
};
prettierCustomized = prettier-with-plugins.prettier {
enabled = with prettier-with-plugins.plugins; [
## Third-party
prettier-plugin-apex
prettier-plugin-astro
prettier-plugin-elm
prettier-plugin-erb
prettier-plugin-gherkin
prettier-plugin-glsl
prettier-plugin-go-template
prettier-plugin-jinja-template
prettier-plugin-kotlin
prettier-plugin-motoko
prettier-plugin-prisma
prettier-plugin-properties
prettier-plugin-rust
prettier-plugin-sh
prettier-plugin-solidity
prettier-plugin-sql
prettier-plugin-sql-cst
prettier-plugin-svelte
prettier-plugin-toml
]
++ (with prettier-with-plugins; [
## Official
plugins."@prettier/plugin-php"
plugins."@prettier/plugin-pug"
plugins."@prettier/plugin-ruby"
plugins."@prettier/plugin-xml"
## Third-party
plugins."@stedi/prettier-plugin-jsonata"
]);
in
{
home-manager.users."yourName".config.programs.vim {
enable = true;
plugins = with pkgs.vimPlugins; [
vim-prettier
];
extraConfig = ''
autocmd FileType php,ruby,xml,astro,rust,sh,solidity,sql,toml let b:prettier_exec_cmd = "prettier-stylelint"
let g:prettier#exec_cmd_path = "${prettierCustomized}/bin/prettier"
'';
};
}Then rebuild as usual!
This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.
Adding prettier-plugin-nginx to enabled configuration...
prettierCustomized = prettier-with-plugins.prettier {
enabled = with prettier-with-plugins.plugins; [
+ prettier-plugin-nginx... and rebuild results in following error;
Executing versionCheckPhase
Did not find version 3.5.3 in the output of the command /nix/store/<HASH>-prettier-3.5.3/bin/prettier --help
[error] Cannot find module 'prettier/doc'
[error] Require stack:
[error] - {{storeDir}}/lib/node_modules/prettier-plugin-nginx/dist/index.js
Did not find version 3.5.3 in the output of the command /nix/store/<HASH>-prettier-3.5.3/bin/prettier --version
[error] Cannot find module 'prettier/doc'
[error] Require stack:
[error] - {{storeDir}}/lib/node_modules/prettier-plugin-nginx/dist/index.js
Options for contributing to prettier-with-plugins and nix-utilities
Start making a Fork of this repository to an account that you have write permissions for.
- Add remote for fork URL. The URL syntax is
[email protected]:<NAME>/<REPO>.git...
cd ~/git/hub/nix-utilities/prettier-with-plugins
git remote add fork [email protected]:<NAME>/prettier-with-plugins.git- Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/nix-utilities/prettier-with-plugins
git commit -F- <<'EOF'
:bug: Fixes #42 Issue
**Edits**
- `<SCRIPT-NAME>` script, fixes some bug reported in issue
EOF
git push fork mainNote, the
-uoption may be used to setforkas the default remote, eg.git push -u fork mainhowever, this will also default theforkremote for pulling from too! Meaning that pulling updates fromoriginmust be done explicitly, eg.git pull origin main
- Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is
https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>
Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.
Thanks for even considering it!
Via Liberapay you may
on a
repeating basis.
Regardless of if you're able to financially support projects such as prettier-with-plugins that nix-utilities maintains, please consider sharing projects that are useful with others, because one of the goals of maintaining Open Source repositories is to provide value to the community.
- GitHub --
NixOS/nixpkgs#341798--prettercannot find a plugin installed -- workaround bybenj9000 - GitHub --
github-utilities/make-readme - Prettier Docs -- Plugins
prettier-with-plugins: Nix re-packaging of prettier to enable plugins
Copyright (C) 2025 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For further details review full length version of AGPL-3.0 License.
@prettier/plugin-php@prettier/plugin-pug@prettier/plugin-ruby@prettier/plugin-xmlprettier-plugin-apexprettier-plugin-astroprettier-plugin-erbprettier-plugin-gherkinprettier-plugin-glslprettier-plugin-go-templateprettier-plugin-jinja-templateprettier-plugin-jsonataprettier-plugin-kotlinprettier-plugin-prismaprettier-plugin-propertiesprettier-plugin-rustprettier-plugin-shprettier-plugin-solidityprettier-plugin-sqlprettier-plugin-svelteprettier-plugin-toml