Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help adding bioconda channel #526

Open
vsoch opened this issue Dec 2, 2022 · 1 comment
Open

Help adding bioconda channel #526

vsoch opened this issue Dec 2, 2022 · 1 comment

Comments

@vsoch
Copy link

vsoch commented Dec 2, 2022

Hi! I'm trying to add bioconda to my flake.nix, but this fails:

{
  description = "ConveyorLC Environment";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    rse-ops.url = "github:rse-ops/nix";
    flake-utils.url = "github:numtide/flake-utils";
    mach-nix = {
        url = "github:DavHau/mach-nix/3.4.0";
        condaChannelsExtra.bioconda = [
          (builtins.fetchurl "https://conda.anaconda.org/bioconda/linux-64/repodata.json")
          (builtins.fetchurl "https://conda.anaconda.org/bioconda/noarch/repodata.json")
        ];
    };
    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };
  };

  outputs = { self, nixpkgs, flake-utils, flake-compat, rse-ops, mach-nix, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        rseops = rse-ops.packages.${system};
        mach = mach-nix.lib.${system};
        python-deps = mach.mkPython {
            requirements = ''
                numpy
                ambertools
                scipy
                matplotlib
                setuptools
                mpi4py
            '';
             providers = {
                 _default = "conda/main,conda/bioconda,conda/conda-forge,nixpkgs,wheel,sdist";
             };
        };
        buildInputs = with pkgs ; [
            rseops.conveyorlc
            python-deps
        ];
        shell-inputs = pkgs: with pkgs ; [
           bash
           git
           vim
         ] ++ buildInputs;

      in {
          devShells.default = pkgs.mkShell {
            nativeBuildInputs = shell-inputs pkgs;
            buildInputs = buildInputs;
        };
         packages.default = pkgs.stdenv.mkDerivation {
           pname = "conveyorlc-env";
           version="0.0.1";
           src = self; 
           nativeBuildInputs = shell-inputs pkgs;
           buildInputs = buildInputs;
           format = "other";
           installPhase = ''
             mkdir -p $out
             touch $out/dinosaur.txt
           '';

         };
   });
}

I can see the examples in the wild, https://discourse.nixos.org/t/mach-nix-create-python-environments-quick-and-easy/6858/86?page=5#include-extra-conda-channels-13 but I can't figure out how to adopt for my recipe.

Thanks for your help!

@hall
Copy link

hall commented Jan 21, 2023

What's the error?

I'm guessing it doesn't like inputs.mach-nix.condaChannelsExtra. Try removing that and replacing

{
  mach = mach-nix.lib.${system};
}

with something along these lines

{
  mach = import mach-nix {
    inherit pkgs;
    condaChannelsExtra = {};
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants