Nix Flake 获得特定的 python 版本
Nix Flake get a specific python version
我正在尝试制作一个 Nix 薄片,它将使用 poetry2nix 来构建一个诗歌项目代码是
{
description = "searx : flake";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-20.03;
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
with import nixpkgs { system = "x86_64-linux";
buildInputs = [
nixpkgs.python39
nixpkgs.git
nixpkgs.openssl
nixpkgs.python39Packages.pip
nixpkgs.uwsgi
nixpkgs.python39Packages.virtualenv
nixpkgs.poetry
];
};
pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
src = pkgs.fetchgit {
url = "https://github.com/searx/searx.git";
rev = "ae122ea943f77600fd97556503c483dcd92e1e63";
sha256 = "sIJ+QXwUdsRIpg6ffUS3ItQvrFy0kmtI8whaiR7qEz4=";
};
};
};
但是 Nix 薄片开始拉动 python3.7 并因以下错误而断裂
ERROR: Could not find a version that satisfies the requirement importlib-metadata; python_version < "3.8" (from click==8.0.1) (from versions: none)
> ERROR: No matching distribution found for importlib-metadata; python_version < "3.8" (from click==8.0.1)
等同于 default.nix 拉取 python 3.9 并成功构建。我相信如果可以将 flake 固定到 python3.9,它将能够构建它。这可能吗?
你可以再传一个python
to mkPoetryApplication
.
pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
python = pkgs.python39;
# ... your code ...
}
我正在尝试制作一个 Nix 薄片,它将使用 poetry2nix 来构建一个诗歌项目代码是
{
description = "searx : flake";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-20.03;
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
with import nixpkgs { system = "x86_64-linux";
buildInputs = [
nixpkgs.python39
nixpkgs.git
nixpkgs.openssl
nixpkgs.python39Packages.pip
nixpkgs.uwsgi
nixpkgs.python39Packages.virtualenv
nixpkgs.poetry
];
};
pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
src = pkgs.fetchgit {
url = "https://github.com/searx/searx.git";
rev = "ae122ea943f77600fd97556503c483dcd92e1e63";
sha256 = "sIJ+QXwUdsRIpg6ffUS3ItQvrFy0kmtI8whaiR7qEz4=";
};
};
};
但是 Nix 薄片开始拉动 python3.7 并因以下错误而断裂
ERROR: Could not find a version that satisfies the requirement importlib-metadata; python_version < "3.8" (from click==8.0.1) (from versions: none)
> ERROR: No matching distribution found for importlib-metadata; python_version < "3.8" (from click==8.0.1)
等同于 default.nix 拉取 python 3.9 并成功构建。我相信如果可以将 flake 固定到 python3.9,它将能够构建它。这可能吗?
你可以再传一个python
to mkPoetryApplication
.
pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
python = pkgs.python39;
# ... your code ...
}