You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm pretty new to Nix and Poetry, so forgive me if there is something obvious I am missing.
I'm trying to build a poetry app from github so that it is accessible system-wide. The app is called sqlfmt. Usually I'd install sqlfmt with pacman or pip on an Arch system. But I've recently discovered that sqlfmt is not available in the nixos repos, and I need it for my work.
Here is my flake.nix
{description="Application packaged using poetry2nix";inputs={flake-utils.url="github:numtide/flake-utils";nixpkgs.url="github:NixOS/nixpkgs/nixos-unstable-small";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.pkgs=nixpkgs.legacyPackages.${system};src=pkgs.fetchFromGitHub{owner="tconbeer";name="shandy-sqlfmt";repo="sqlfmt";rev="v0.21.3";sha256="1sx8gf13pwsw63v5hfnml18fs2lnb2piigc1d4q8hmiywzmhzf85";};inherit(poetry2nix.lib.mkPoetry2Nix{inheritpkgs;})mkPoetryApplication;in{packages={sqlfmt=mkPoetryApplication{projectDir=src;};default=self.packages.${system}.sqlfmt;};});}
The package builds ok, but at the end I get an error saying:
error: unable to execute '/nix/store/wrarga4hs89sqsqwhydq9mm8mz9c86sc-python3.11-shandy-sqlfmt-0.21.3/bin/shandy-sqlfmt': No such file or directory
For some reason it's looking for shandy-sqlfmt instead of sqlfmt. Indeed if I look inside /nix/store/wrarga4hs89sqsqwhydq9mm8mz9c86sc-python3.11-shandy-sqlfmt-0.21.3/bin/ I can see and execute the sqlfmt script.
I think this is because the package name in sqlfmt's pyproject.toml is set to "shandy-sqlfmt"
[tool.poetry]
name = "shandy-sqlfmt"
Whereas the script name is sqlfmt.
If I clone the sqlfmt repo and manually modify the name field from "shandy-sqlfmt" to "sqlfmt", I can successfully build the app.
So I guess my question is: is it possible to tell poetry2nix to build the remote package using a different name than the one specified in the pyproject.toml?
I would really appreciate some assistance here.
The text was updated successfully, but these errors were encountered:
What command is eliciting that error? It seems like you're trying run the command as shandy-sqlfmt, which isn't possible because as you say the command is called sqlfmt. So, whatever is invoking shandy-sqlfmt is doing so incorrectly, but that doesn't seem to be happening inside poetry, nix or poetry2nix anywhere.
I'm pretty new to Nix and Poetry, so forgive me if there is something obvious I am missing.
I'm trying to build a poetry app from github so that it is accessible system-wide. The app is called sqlfmt. Usually I'd install sqlfmt with pacman or pip on an Arch system. But I've recently discovered that sqlfmt is not available in the nixos repos, and I need it for my work.
Here is my flake.nix
The package builds ok, but at the end I get an error saying:
For some reason it's looking for shandy-sqlfmt instead of sqlfmt. Indeed if I look inside
/nix/store/wrarga4hs89sqsqwhydq9mm8mz9c86sc-python3.11-shandy-sqlfmt-0.21.3/bin/
I can see and execute the sqlfmt script.I think this is because the package name in sqlfmt's pyproject.toml is set to "shandy-sqlfmt"
Whereas the script name is sqlfmt.
If I clone the sqlfmt repo and manually modify the name field from "shandy-sqlfmt" to "sqlfmt", I can successfully build the app.
So I guess my question is: is it possible to tell poetry2nix to build the remote package using a different name than the one specified in the pyproject.toml?
I would really appreciate some assistance here.
The text was updated successfully, but these errors were encountered: