mach-nix icon indicating copy to clipboard operation
mach-nix copied to clipboard

Help adding bioconda channel

Open vsoch opened this issue 2 years ago • 1 comments

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!

vsoch avatar Dec 02 '22 02:12 vsoch

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 = {};
  };
}

hall avatar Jan 21 '23 03:01 hall