I’m managed to install the haskell.haskell extension through my
configuration.nix file (I know this probably should be a user, not system wide thing but I’m not up to splitting the config like that yet).
However, it’s at version 1.7.1, whereas the current version is 1.8.
This leads me to a few questions:
- How do I get nix to install the latest version?
- How is it okay to even specify an extension without a version? Isn’t NixOS about reproducibility? Or is there a “version” of NixOS I’m using, and that “snapshot” (for want of a better word) explicitly lists extension versions? Can I “update” that snapshot to get newer extension versions?
- Can I specify the version of an extensions without going through the details like listing the SHA256 hash of it etc?
I assume you are using the channel approach to manage your system, which provides only limited reproducibility on its own.
A channel does indeed point to a “snapshot” of nixpkgs, which fixes all of its contents to certain revisions/versions.
You can update that snapshot by using
nix-channel --update, which you might need to run as root to update the correct set of channels.
Sadly there is no built-in way to Tel the channel to use a certain snapshot. It’s either the one that was set during last update, or the most recent one when you update the next time.
You can pull directly from the VSCode Marketplace with
pkgs.vscode-utils.extensionsFromVscodeMarketplace (see e.g. https://github.com/Smaug123/nix-dotfiles/blob/2463b3275b1dfb89137bd39ace6c6defa7a28e30/vscode-extensions.nix#L11 used in https://github.com/Smaug123/nix-dotfiles/blob/2463b3275b1dfb89137bd39ace6c6defa7a28e30/home.nix#L63). You still need to get the SHA right though (I usually do this by just setting the SHA to some nonsense value and then letting
darwin-rebuild switch fail and tell me what it actually got).
Would that approach also work if I want to preinstall the extensions in
It’s been on my very long to-do list, to try and make this more similar to
vimPlugins, in which we can just have a top-level registry of extension names. And then just have some update logic to generate the latest of each.