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:
2024-04-16 17:14:00 +02:00
$ nix develop -c bash -c "conda-shell -c 'conda activate <environment-name> && sh'"
2024-04-10 22:32:35 +02:00
If you are using Pycharm, you can start up quickly by running:
$ nix develop -c bash -c "conda-shell -c pycharm-professonial && exit"
### Setup: ###
2024-04-16 17:14:00 +02:00
On your first run, install conda and set up your environment using
2024-04-10 22:32:35 +02:00
2024-04-16 17:14:00 +02:00
$ nix develop -c bash -c "conda-shell -c 'conda-install'"
$ nix develop -c bash -c "conda-shell -c 'conda-env create --name <environment-name> --file /path/to/environment.yaml'"
2024-04-10 22:32:35 +02:00
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-16 17:14:00 +02:00
(jetbrains.plugins.addPlugins jetbrains.pycharm-professional [ "github-copilot" ])
2023-09-25 20:45:08 +02:00
];
};
});
}