Python: Difference between revisions

imported>Tobias.bora
#with is outdated
imported>2gn
m Upgraded mach-nix version from 3.4.0 to 3.5.0 . Micromamba is now in stable channel. Removed old archive link of nixpkgs (This change may make the document less reproducible.)
Line 264: Line 264:
     url = "https://github.com/DavHau/mach-nix/";
     url = "https://github.com/DavHau/mach-nix/";
     # place version number with the latest one from the github releases page
     # place version number with the latest one from the github releases page
     ref = "refs/tags/3.4.0";
     ref = "refs/tags/3.5.0";
   }) {};
   }) {};
in
in
Line 278: Line 278:


Alternatively install the mach-nix cmdline tool  
Alternatively install the mach-nix cmdline tool  
<code>nix-env -if https://github.com/DavHau/mach-nix/tarball/3.4.0 -A mach-nix</code>  
<code>nix-env -if https://github.com/DavHau/mach-nix/tarball/3.5.0 -A mach-nix</code>  
and run  
and run  
<syntaxhighlight lang="shell">
<syntaxhighlight lang="shell">
Line 296: Line 296:
=== micromamba ===
=== micromamba ===


Install the <code>micromamba</code> package (currently in <code>nixpkgs-21.11</code> and later).
Install the <code>micromamba</code> package.
You can create environments and install packages as [https://github.com/mamba-org/mamba#micromamba documented by micromamba] e.g.
You can create environments and install packages as [https://github.com/mamba-org/mamba#micromamba documented by micromamba] e.g.
<syntaxhighlight lang="shell">
<syntaxhighlight lang="shell">
micromamba create -n my-environment python=3.7 numpy=1.21.0 -c conda-forge
micromamba create -n my-environment python=3.9 numpy=1.23.0 -c conda-forge
</syntaxhighlight>
</syntaxhighlight>


Line 313: Line 313:
Eventually you'll probably want to put this in a shell.nix so you won't have to type all that stuff every time e.g.:
Eventually you'll probably want to put this in a shell.nix so you won't have to type all that stuff every time e.g.:
<syntaxhighlight lang="shell">
<syntaxhighlight lang="shell">
{ pkgs ? import <nixpkgs> {}}:
let
let
  pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/79b7bd36a358f90ffd287b061132641175b8d31e.tar.gz") {};
   fhs = pkgs.buildFHSUserEnv {
   fhs = pkgs.buildFHSUserEnv {
     name = "my-fhs-environment";
     name = "my-fhs-environment";