Use Nix to Setup Development Environment on MacOS

Why

use nix develop to spawn a shell with an application’s development dependenciesin scope. To achieve this, you should create a flake that uses mkShell.

TBD

What

How

  • To check nix store disk usage: du -hsc /nix/store.
  • To reduce nix store disk uage: nix-collect-garbage.
  • For the design of nix, same servide will be launched for differernt project. To avoid conflicts, we can assign differernt ports for them. And kill those service on leave nix shell.

A samll discovery of rails. Rails will use PGPORT env variable, if it’s defined, and use that port to connect to psql.

  • Here is how to quit on exit shell: https://github.com/legendofmiracles/lila/blob/nix/shell.nix

but above only works on bash. for zsh, I have no clue.

Where

When

References:

Written on September 21, 2024