diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index 7395090060cb..24b77f613154 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -43,6 +43,7 @@ mapAliases { "@githubnext/github-copilot-cli" = pkgs.github-copilot-cli; # Added 2023-05-02 "@google/clasp" = pkgs.google-clasp; # Added 2023-05-07 "@nestjs/cli" = pkgs.nest-cli; # Added 2023-05-06 + bibtex-tidy = pkgs.bibtex-tidy; # added 2023-07-30 bitwarden-cli = pkgs.bitwarden-cli; # added 2023-07-25 eslint_d = pkgs.eslint_d; # Added 2023-05-26 manta = pkgs.node-manta; # Added 2023-05-06 diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index 29494ae3755c..8d54b0e0baa3 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -39,7 +39,6 @@ , "awesome-lint" , "balanceofsatoshis" , "bash-language-server" -, "bibtex-tidy" , "bower" , "bower2nix" , "browserify" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index 196e4bad11fb..8d40bb8b553f 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -94386,24 +94386,6 @@ in bypassCache = true; reconstructLock = true; }; - bibtex-tidy = nodeEnv.buildNodePackage { - name = "bibtex-tidy"; - packageName = "bibtex-tidy"; - version = "1.11.0"; - src = fetchurl { - url = "https://registry.npmjs.org/bibtex-tidy/-/bibtex-tidy-1.11.0.tgz"; - sha512 = "jbY7PxjYQlRQIWpqdCxEVtW0T9xTLecXxvGPFGMs3FlzKNTylTr5yutC2qWsFyfNQgMHvAzyCdqT5YIU9p/ZHg=="; - }; - buildInputs = globalBuildInputs; - meta = { - description = "Tidy bibtex files"; - homepage = "https://github.com/FlamingTempura/bibtex-tidy"; - license = "MIT"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; bower = nodeEnv.buildNodePackage { name = "bower"; packageName = "bower"; diff --git a/pkgs/tools/typesetting/bibtex-tidy/default.nix b/pkgs/tools/typesetting/bibtex-tidy/default.nix new file mode 100644 index 000000000000..7aeaf13fb02a --- /dev/null +++ b/pkgs/tools/typesetting/bibtex-tidy/default.nix @@ -0,0 +1,35 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +}: + +buildNpmPackage rec { + pname = "bibtex-tidy"; + version = "1.11.0"; + + src = fetchFromGitHub { + owner = "FlamingTempura"; + repo = "bibtex-tidy"; + rev = "v${version}"; + hash = "sha256-VjQuMQr3OJgjgX6FdH/C4mehf8H7XjDZ9Rxs92hyQVo="; + }; + + patches = [ + # downloads Google fonts during `npm run build` + ./remove-google-font-loader.patch + ]; + + npmDepsHash = "sha256-u2lyG95F00S/bvsVwu0hIuUw2UZYQWFakCF31LIijSU="; + + env = { + PUPPETEER_SKIP_DOWNLOAD = true; + }; + + meta = { + changelog = "https://github.com/FlamingTempura/bibtex-tidy/blob/${src.rev}/CHANGELOG.md"; + description = "Cleaner and Formatter for BibTeX files"; + homepage = "https://github.com/FlamingTempura/bibtex-tidy"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ bertof ]; + }; +} diff --git a/pkgs/tools/typesetting/bibtex-tidy/remove-google-font-loader.patch b/pkgs/tools/typesetting/bibtex-tidy/remove-google-font-loader.patch new file mode 100644 index 000000000000..79c6850cf6cb --- /dev/null +++ b/pkgs/tools/typesetting/bibtex-tidy/remove-google-font-loader.patch @@ -0,0 +1,52 @@ +diff --git a/build.ts b/build.ts +index ae4e350..3498ae7 100644 +--- a/build.ts ++++ b/build.ts +@@ -312,7 +312,6 @@ async function buildWebBundle() { + target: ['esnext'], + plugins: [ + sveltePlugin({ preprocess: autoPreprocess() }), +- googleFontPlugin, + regexpuPlugin, + ], + }); +@@ -344,7 +343,6 @@ async function serveWeb() { + preprocess: autoPreprocess(), + compilerOptions: { enableSourcemap: true }, + }), +- googleFontPlugin, + ], + }); + const server = await ctx.serve({ servedir: WEB_PATH }); +@@ -375,31 +373,6 @@ const regexpuPlugin: Plugin = { + }, + }; + +-// Downloads google fonts and injects them as base64 urls into bundle css +-const googleFontPlugin: Plugin = { +- name: 'google-font-loader', +- setup(build) { +- build.onResolve({ filter: /^https?:\/\/fonts\./ }, (args) => ({ +- path: args.path, +- namespace: 'http-url', +- })); +- build.onLoad( +- { filter: /.*/, namespace: 'http-url' }, +- async (args): Promise => { +- const res = await fetch(args.path, { +- headers: { +- // ensures google responds with woff2 fonts +- 'User-Agent': 'Mozilla/5.0 Firefox/90.0', +- }, +- }); +- const contents = Buffer.from(await res.arrayBuffer()); +- const loader = args.path.endsWith('.woff2') ? 'dataurl' : 'css'; +- return { contents, loader }; +- } +- ); +- }, +-}; +- + /** + * swc converts js syntax to support older browsers. ESBuild can kinda do this + * but only for more recent browsers. swc is also far easier to configure than diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 780b655cd1fa..8343b97e6c0b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -340,7 +340,7 @@ with pkgs; beyond-identity = callPackage ../tools/security/beyond-identity { }; - bibtex-tidy = nodePackages.bibtex-tidy; + bibtex-tidy = callPackage ../tools/typesetting/bibtex-tidy { }; binbloom = callPackage ../tools/security/binbloom { };