Civet
Civet copied to clipboard
feat: add nix packages and devshell
this flake lets nix users
- run the civet cli with
nix run github:danielxmoore/civetornix run github:danielxmoore/civet#cli - run the lsp with
nix run github:danielxmoore/civet#ls -- --stdio. - install the vscode extension into their nix defined vscode configs (from the
vscode-extensionoutput), - or compile it into a vsix with
nix build github:danielxmoore/civet#vscode-vsix
it also adds a devshell that can be enabled with nix develop github:danielxmoore/civet to get in an ephemeral environment that exposes nodejs, yarn and the exact same versions of bash, sed and any other build requirements as they're locked by flake.lock.
all the maintenance effort this adds is updating yarnDepsHash whenever any corresponding yarn.lock file is modified, seems like there isn't a straightforward document i can link for this but i'll write another comment with instructions within the day
to update yarnDepsHash after modifying yarn.lock files a maintainer should
- omit the
yarnDepsHashfield frommkCivetPackage's arguments for their package - build the target package with
nix build .#<output-name> - wait for the new dependencies to be downloaded and hashed, an expected error will be emitted from this step as follows:
error: hash mismatch in fixed-output derivation '/nix/store/sgqsgja2ax43633r4jjdvh9inb8inxqj-offline.drv': specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= got: sha256-pEpST+ZWDJYzIaxeb4ou8rLtNwgnKv0SdahHJ15bgn8= error: Cannot build '/nix/store/vwm5gkrk9gl26s26vgkmcyji7barafv1-civet-0.10.5.drv'. Reason: 1 dependency failed. Output paths: /nix/store/1fkmcwawv0zzkaninsy90nynci314i5q-civet-0.10.5 - copy the value of "got", which in this example is
sha256-pEpST+ZWDJYzIaxeb4ou8rLtNwgnKv0SdahHJ15bgn8=and use it as the newyarnDepsHash - rerun the build step after updating the hash and commit the change after it builds successfully
there are tools that attempt to automate this process but i don't find any of them convenient enough to use.
We could probably make a bash script that automates the update.
@STRd6, i added an update script
the cli issue should be fixed now. it was based on a misunderstanding on my end of how the cli is bundled. now instead of overriding the installPhase added by yarnInstallHook i moved the entrypoint creation code to a fixupPhase that runs after the installation code. this results in a civet cli entrypoint that has access to node_modules during runtime.