Advice on Nix usage for software project and cluster usage (flake vs shell)

Hello,
I was wondering about good practices for using nix in the development setting.

I have a project which I would like to interact with in 2 ways:

  • Develop (write code) on my laptop which is running NixOS
  • Run the code on a cluster which supports the Nix package manager

I guess this is a good use case for Nix in which I could replicate exactly the environment.
For now, I only use nix on the laptop side and I use a nix-shell.

How would nix flake compare to a nix shell for this use case ?
Is it more interesting ?
Generally, how are you dealing with such use cases ? You would have a shell.nix / flake.nix file in your repo ?

I would be happy to here about your experience :slight_smile:

A flake can contain the description of a shell, which is used by nix develop.

Flakes do not replace previous functionality they extend them a bit, and wrap them in a common interface.

2 Likes