A posteriori Nix shells
You have a dirty software environment and you want to get Nix shells with the same packages and versions.
Describe the different shells, packages, and desired versions in a YAML file:
- shell: analysis
packages:
- name: python310
version: "3.10.8"
with_packages:
- name: numpy
version: "1.24.2"
- name: matplotlib
version: "3.7.1"
- shell: dev
packages:
- name: gcc
version: "12.3.0"
- name: cmake
version: "3.24.3"
-
shell
sets the name of the shell -
packages
is a list of pairs (name
,version
) -
for some packages (
python
,R
, ...), you can use thewith_packages
fields to add some packages (numpy
andmatplotlib
in the example above)
Then run mop
:
mop envs.yaml
mop
will generate a flake.nix
file that tries to match as best as it can the desired environments.
-
mop
calls Nixhub under the hood to retrieve the correctnixpkgs
commits -
you do want to call a nix formatter on the generated
flake.nix
!! -
for now, the
with_packages
supports fullypython
, and partiallyR
-
it might require you to edit the
flake.nix
to fill up somesha256
orhash