Youwen Wu
d07a769a37
Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/c3aa7b8938b17aebd2deecf7be0636000d62a2b9' (2024-08-14) → 'github:NixOS/nixpkgs/1355a0cbfeac61d785b7183c0caaec1f97361b43' (2024-09-10) |
||
---|---|---|
flake.lock | ||
flake.nix | ||
LICENSE | ||
README.md |
Nix development environments, for various languages
Those of us on NixOS never install language toolkits system-wide, unlike other distros. This means that when we
work on projects which expect you to bring your own language tools, we don't have things like node
, npm
, cargo
, etc.
readily available in the shell.
Regrettably, many projects are not taking advantage of Nix for reproducible development environments. You should make a big fuss about this in every open source project you are a part of and constantly evangelize about Nix. Until Nix is universally adopted, this repository serves as a collection of flakes which provides compilers, package managers, and basic development tools like LSPs for common languages. Simply clone this to a desired location, then run:
nix develop <location-of-repo>#<language>
# example
nix develop ~/.devenvs#rustNightly
# provides rust-analyzer, rustc, cargo, and some others from nightly toolchain
Automatic environment loading
For convenience, you can use nix-direnv to automatically load these environments.
Simply add the following .envrc
to the project directory:
# file: .envrc
use flake <path-to-this-repo>#<language>
Example:
use flake ~/.devenvs#go
If you don't want to commit these files, make sure to run the following:
# tell git to ignore these direnv files for this local repository
git update-index --skip-worktree .envrc .direnv
Use without downloading
You can also use this in nix develop
or with direnv
without downloading it locally it.
Simply reference the flake remotely like so:
nix develop "github:youwen5/nix-dev-envs#<environment>"
Or in direnv, similarly:
use flake "github:youwen5/nix-dev-envs#<environment>"
Warning
You may not be able to access these environments offline, so you should clone the repo if you want to be able to activate them when offline.
Provided environments:
- Go
- Python (using poetry)
- Haskell (with Cabal)
- Haskell (with Stack)
- Rust (stable, nightly, and beta toolchains)
- Node/TypeScript (pnpm, yarn, and npm variants)
- Typst
- LaTeX (via texlive, with full and minimal variants)
- Zig