From e1bfbf4b7c81a6794b24abdbc517cfca97d149f8 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Mon, 16 Dec 2024 22:12:19 -0600 Subject: [PATCH] docs: Add notes on Flake npm weirdness [ci skip] --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ca73784..400066a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ -# millironx.github.io +# pages -My personal website. Now hosted over at https://millironx.com +[![status-badge](https://woodpecker.millironx.com/api/badges/30/status.svg?branch=master)](https://woodpecker.millironx.com/repos/30/branches/master) + +My personal website. Hosted over at + +## Notes to self + +All dependencies are now bundled as a Nix Flake. The only trouble with this is +that npm packages don't play well with Nix (and especially Flakes), so npm +packages are specified twice: once in `package{-lock}.json` and then again in +`node*.nix`. + +Compounding this, there are formatters and commit hooks that require npm to be +functional. So, to develop right now requires allowing direnv to setup the Nix +development shell, then immediately installing npm packages via `npm ci`. VSCode +(with extensions) and Zed are smart enough to figure out how to use direnv, but +other programs (like SourceGit) not so much, so you'll need to launch those +programs from inside a direnv shell to make sure they have Prettier, Husky, and +all that jazz to execute the hooks. + +Last compounding factors: if `node_modules` is present in the root directory, +then node2nix won't create a correct derivation, so `node_modules` will need to +be temporarily deleted after modifying any npm packages, then as soon as +node2nix is happy, then immediately run `npm ci` to get the commit hooks working +again. Oh, and also, I renamed the `default.nix` file generated by node2nix to +node.nix to avoid giving direnv any wrong impressions about what derivation to +run. + +Yes, hopefully I can get completely away from npm here soon, but this is a minor +inconvenience considering how (not) often I install new packages into this site, +and really discourages me from contributing to the website obesity crisis.