Created
September 29, 2024 14:31
-
-
Save chuwy/a8bd3482d67beded53e9b7a16ad7f151 to your computer and use it in GitHub Desktop.
poetry2nix install instructions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} }: | |
let | |
python = pkgs.python3; | |
poetry2nix = pkgs.stdenv.mkDerivation rec { | |
name = "poetry2nix"; | |
src = pkgs.fetchFromGitHub { | |
owner = "nix-community"; | |
repo = "poetry2nix"; | |
rev = "2024.9.2866240"; # Replace with the latest version | |
sha256 = "sha256-4e6cny6AHzQcyXH3fqSHIXC5wx8mv6hdP4lP7EtnbnQ="; # Update this hash | |
}; | |
buildInputs = [ | |
(python.withPackages (ps: [ ps.toml ])) | |
]; | |
nativeBuildInputs = [ | |
pkgs.makeWrapper | |
]; | |
dontConfigure = true; | |
buildPhase = '' | |
runHook preBuild | |
# this is the ./bin/poetry2nix | |
patchShebangs bin/poetry2nix | |
runHook postBuild | |
''; | |
installPhase = '' | |
runHook preInstall | |
mkdir -p $out/bin | |
# need to remap this to be consistent with `pkgs.lib.getBin` "standard" | |
mv bin/poetry2nix $out/bin/${name} | |
wrapProgram $out/bin/${name} --prefix PATH ":" ${pkgs.lib.makeBinPath [ | |
pkgs.nix-prefetch-git | |
]} | |
runHook postInstall | |
''; | |
# installPhase = '' | |
# mkdir -p $out/bin | |
# cp bin/poetry2nix $out/bin/poetry2nix | |
# ''; | |
}; | |
in | |
pkgs.mkShell { | |
buildInputs = [ | |
pkgs.python3 | |
poetry2nix | |
]; | |
shellHook = '' | |
echo "poetry2nix shell" | |
''; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment