flakes/python/conda/flake.nix

48 lines
1.3 KiB
Nix
Raw Normal View History

2023-09-25 20:45:08 +02:00
{
description = ''
Python flake for use with conda environments.
2024-04-10 22:32:35 +02:00
This will create a directory ~/.conda, which might become rather large,
2023-09-25 20:45:08 +02:00
depending on your required packages.
2024-04-10 22:32:35 +02:00
### 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
2023-09-25 20:45:08 +02:00
'';
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
};
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;
2024-04-10 22:32:35 +02:00
# (jetbrains.plugins.addPlugins jetbrains.pycharm-professional [ "github-copilot" ])
2023-09-25 20:45:08 +02:00
];
};
});
}