Skip to content

Instantly share code, notes, and snippets.

@smaret
Last active July 19, 2022 15:05
Show Gist options
  • Save smaret/68e7a22b573155697715cf36c47ef660 to your computer and use it in GitHub Desktop.
Save smaret/68e7a22b573155697715cf36c47ef660 to your computer and use it in GitHub Desktop.
# This files creates a development environment using the Nix package
# manager.
#
# The environment is isolated (i.e. it does not use any system
# librairies or binaries) and pinned (the version of each packages is
# fixed), which ensures reproducibility (i.e. system updates will not
# break things).
#
# Usage: run `nix-shell` in the same directory than this file.
with import
(
# Get the latest Nixpkgs stable release (22.05)
fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/22.05.tar.gz";
sha256 = "0d643wp3l77hv2pmg2fi7vyxn4rwy0iyr8djcw1h5x72315ck9ik";
}
)
{ };
let
# Import the Nix User Repository (NUR) to get access to packages
# that are not in nixpkgs.
nur = import
(
fetchTarball {
url = "https://github.com/nix-community/NUR/archive/d555cf3bf91bb13bca12d011d6e180dec50066c2.tar.gz";
sha256 = "1iy3g9xgahvndmyk99lz60jfsrrzc89fypvpb1sjkqxzd6z5ri2f";
}
)
{ inherit pkgs; };
mcfost = nur.repos.smaret.mcfost;
pymcfost = nur.repos.smaret.pymcfost;
lmfit = nur.repos.smaret.lmfit;
# Define a Python environment containing several modules. More
# modules can be added within the brackets, if they are present in
# Nixpkgs (all the standard ones should).
python3Env = python3.withPackages (
ps: with ps; [
astropy
emcee
lmfit
numpy
pandas
pymcfost
scipy
]
);
in
mkShell rec {
# Build a shell containing Python 3 and MCFOST.
buildInputs = [
python3Env
mcfost
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment