Total beginner with nix but I thought I would give it a try with a small python/snakemake environment (what a mistake! I ended up in the rabbit hole of nix and python packages…).
So I have already dodged some issues with setuptools missing with the recommended overlay in poetry2nix. However I stumble on another issue linked to the compilation of one of the python package that requires gsl.
UserWarning: Error occured getting GSL path config: [Errno 2] No such file or directory: 'gsl-config'
Here is my flake.nix
{
description = "poetry2nix env";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
# see https://github.com/nix-community/poetry2nix/tree/master#api for more functions
↪ and examples.
# inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication;
pkgs = nixpkgs.legacyPackages.${system};
p2n = poetry2nix.legacyPackages.${system};
pypkgs-build-requirements = {
newick = [ "setuptools" ];
demes = [ "setuptools" ];
tskit = [ "setuptools" ];
msprime = [ "setuptools" ];
};
p2n-overrides = p2n.defaultPoetryOverrides.extend (self: super:
builtins.mapAttrs (package: build-requirements:
(builtins.getAttr package super).overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ (builtins.map (pkg: if builtins.
↪ isString pkg then builtins.getAttr pkg super else pkg) build-requirements);
})
) pypkgs-build-requirements
);
pythonEnv = p2n.mkPoetryEnv {
projectDir = ./.;
overrides = p2n-overrides;
};
in
{
# packages = {
# myapp = mkPoetryApplication { projectDir = self; };
# default = self.packages.${system}.myapp;
# };
devShells.default = pkgs.mkShell {
packages = [
# pkgs.gsl
pkgs.python310
pkgs.snakemake
poetry2nix.packages.${system}.poetry
pythonEnv
];
};
});
}
The poetry file is pretty simple and only contains msprime as a dependency.
I’d be grateful for any pointer on where I’m supposed to indicate I need gsl in the build process. More generally how does one go about indicating c++ libraries needed for a build for instance.
Thanks