flakes/python/conda/flake.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

2023-09-25 20:45:08 +02:00
{
description = ''
Python flake for use with conda environments.
This will create a directory `~/.conda`, which might be rather large,
depending on your required packages.
'';
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
2023-09-27 14:49:29 +02:00
config.allowUnfree = true;
2023-09-25 20:45:08 +02:00
};
2023-09-27 14:49:29 +02:00
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
'';
2023-09-25 20:45:08 +02:00
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
conda
2023-09-27 14:49:29 +02:00
# You might want to add an IDE of your choice;
jetbrains.pycharm-professional
2023-09-25 20:45:08 +02:00
];
2023-09-27 14:49:29 +02:00
shellHook = IDE-steps;
2023-09-25 20:45:08 +02:00
};
});
}