summary refs log tree commit diff
path: root/pkgs/development/tools/poetry2nix/poetry2nix/cli.nix
blob: fbcee749b7cd25316d589694a835a296454a3a9f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ pkgs ? import <nixpkgs> {}
, lib ? pkgs.lib
, version
}:
let
  inherit (pkgs) python3;
in
pkgs.stdenv.mkDerivation {
  pname = "poetry2nix";
  inherit version;

  buildInputs = [
    (python3.withPackages (ps: [ ps.toml ]))
  ];

  nativeBuildInputs = [
    pkgs.makeWrapper
  ];

  src = ./bin;

  dontConfigure = true;

  buildPhase = ''
    runHook preBuild
    patchShebangs poetry2nix
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    mv poetry2nix $out/bin

    wrapProgram $out/bin/poetry2nix --prefix PATH ":" ${lib.makeBinPath [
    pkgs.nix-prefetch-git
  ]}

    runHook postInstall
  '';

  meta = {
    homepage = "https://github.com/nix-community/poetry2nix";
    description = "CLI to supplement sha256 hashes for git dependencies";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.adisbladis ];
  };

}