Hello all, below is a flake for a project I am working on as well as my pyproject.toml. I installed fastapi with poetry add like so “poetry add fastapi[standard]”. However when I try to run nix develop I get the following error.
trace: evaluation warning: Unknown watchfiles version: '0.24.0'. Please update getCargoHash.
error:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'nix-shell'
whose name attribute is located at /nix/store/bd4fmzws6n5542khxbifbkr6nrygi232-source/pkgs/stdenv/generic/make-derivation.nix:336:7
… while evaluating attribute 'nativeBuildInputs' of derivation 'nix-shell'
at /nix/store/bd4fmzws6n5542khxbifbkr6nrygi232-source/pkgs/stdenv/generic/make-derivation.nix:380:7:
379| depsBuildBuild = elemAt (elemAt dependencies 0) 0;
380| nativeBuildInputs = elemAt (elemAt dependencies 0) 1;
| ^
381| depsBuildTarget = elemAt (elemAt dependencies 0) 2;
(stack trace truncated; use '--show-trace' to show the full trace)
error: attribute '"0.24.0"' missing
at /nix/store/difi403qdcbaqp1nqkig2h4z2g3qqdkg-source/overrides/default.nix:3771:34:
3770| # Watchfiles does not include Cargo.lock in tarball released on PyPi for versions up to 0.17.0
3771| getRepoHash = version: {
| ^
3772| "0.23.0" = "sha256-kFScg3pkOD0gASRtfXSfwZxyW/XvW9x0zgMn0AQek4A=";
Did you mean one of 0.20.0, 0.21.0, 0.22.0, 0.23.0 or 0.14.1?
From my understanding I need to override poetry2nix with the updated watchfiles hash but everything I have tried has been unsuccessful. If I could be pointed in the right direction on how to override poetry2nix with the correct hash that would be greatly appreciated.
Flake.nix
{
description = "A simple poetry project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication mkPoetryEnv;
project-new = mkPoetryApplication {
projectDir = ./.;
};
dep-env = mkPoetryEnv {
projectDir = ./.;
};
dockerImage = pkgs.dockerTools.buildImage {
name = "my-flake-docker-image";
tag = "latest";
config = {
cmd = [ "${project-new}/bin/runner" ];
};
};
in {
packages = {
inherit project-new;
docker = dockerImage;
};
defaultPackage = dockerImage;
devShells.default = pkgs.mkShell {
packages = with pkgs; [dep-env poetry python3Packages.fastapi ];
};
});
}
pyproject.toml
[tool.poetry]
name = "project-new"
version = "0.1.0"
description = ""
authors = ["k-kahora <mango22mjk@gmail.com>"]
readme = "README.md"
[tool.poetry.scripts]
runner = "project_new.app:main"
[tool.poetry.dependencies]
python = "^3.12"
requests = "^2.32.3"
fastapi = {extras = ["standard"], version = "^0.112.2"}
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"