nix-community / nix-init

Generate Nix packages from URLs with hash prefetching, dependency inference, license detection, and more [maintainer=@figsoda]
https://discourse.nixos.org/t/25035
Mozilla Public License 2.0
777 stars 17 forks source link

bitbucket support #139

Open doronbehar opened 1 year ago

doronbehar commented 1 year ago

This fails:

$ nix-init --url=https://bitbucket.org/dtrypogeorgos/pylion pkgs/development/python-modules/pylion/default.nix

Enter tag or revision
❯ unstable
Enter version
❯ unstable
Enter pname
❯ pylion
Error: command exited with exit status: 1
stdout:

stderr:
$ nix-prefetch-url --unpack https://bitbucket.org/dtrypogeorgos/pylion/get/unstable.tar.gz
error: unable to download 'https://bitbucket.org/dtrypogeorgos/pylion/get/unstable.tar.gz': HTTP error 404

       response body:

       Cannot resolve the cset
Error: command exited with exit status: 1
figsoda commented 1 year ago

The most basic stuff works if you manually put in the revision and version

Enter output path (defaults to current directory)
❯ .
Enter url
❯ https://bitbucket.org/dtrypogeorgos/pylion
Enter tag or revision
❯ 8945a7b6f1912ae6b9c705f8a2bd521101f5ba59
Enter version
❯ unstable-2021-11-12
Enter pname
❯ pylion
How should this package be built?
❯ buildPythonApplication - setuptools

though you don't get dependency inference since nix-init doesn't parse setup.py, and some meta is missing since nix-init doesn't support bitbucket yet

{ lib
, python3
, fetchFromBitbucket
}:

python3.pkgs.buildPythonApplication rec {
  pname = "pylion";
  version = "unstable-2021-11-12";
  format = "setuptools";

  src = fetchFromBitbucket {
    owner = "dtrypogeorgos";
    repo = "pylion";
    rev = "8945a7b6f1912ae6b9c705f8a2bd521101f5ba59";
    hash = "sha256-4AdJkoQ1hAssDUpgmARGmN+ihQqRPPOncWJ5ErQyWII=";
  };

  pythonImportsCheck = [ "pylion" ];

  meta = with lib; {
    description = "";
    homepage = "https://bitbucket.org/dtrypogeorgos/pylion";
    license = licenses.mit;
    maintainers = with maintainers; [ ];
  };
}