[python] docs: Update conda usage

This commit is contained in:
Tibo De Peuter 2024-04-10 22:32:35 +02:00
parent 3807441d3a
commit 42cfe1fa22
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
2 changed files with 26 additions and 22 deletions

View file

@ -5,11 +5,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1694529238, "lastModified": 1710146030,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1695360818, "lastModified": 1712608508,
"narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", "rev": "4cba8b53da471aea2ab2b0c1f30a81e7c451f4b6",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -2,8 +2,26 @@
description = '' description = ''
Python flake for use with conda environments. Python flake for use with conda environments.
This will create a directory `~/.conda`, which might be rather large, This will create a directory ~/.conda, which might become rather large,
depending on your required packages. depending on your required packages.
### Usage: ###
You can enter the environment in your CLI with:
$ nix-develop -c bash -c "conda-shell -c 'conda activate <environment-name> && sh'"
If you are using Pycharm, you can start up quickly by running:
$ nix develop -c bash -c "conda-shell -c pycharm-professonial && exit"
### Setup: ###
On your first run, enter conda using
$ nix-develop -c bash -c "conda-shell -c 'conda-install'"
(conda-shell)$ conda env create --name <environment-name> --file /path/to/environment.yaml
''; '';
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -16,28 +34,14 @@
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
}; };
installation-steps = ''
conda-shell -c 'conda-install'
printf 'Run `conda env create --name ai-practica --file environment.yaml` and exit.\n'
conda-shell && exit
'';
IDE-steps = ''
conda-shell -c pycharm-professional && exit
'';
CLI-steps = ''
printf 'Enter your enviroment by running `conda activate ai-practica`.\n'
conda-shell && exit
'';
in { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
conda conda
# You might want to add an IDE of your choice; # You might want to add an IDE of your choice;
jetbrains.pycharm-professional # (jetbrains.plugins.addPlugins jetbrains.pycharm-professional [ "github-copilot" ])
]; ];
shellHook = IDE-steps;
}; };
}); });
} }