summary refs log tree commit diff
path: root/pkgs/applications/networking/zerobin/default.nix
blob: 56d5274751fcebb4a6c4eca59f826f789d883dcb (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ lib
, python3Packages
, fetchFromGitHub
, nodePackages
}:

python3Packages.buildPythonApplication rec {
  pname = "zerobin";
  version = "1.0.5";

  src = fetchFromGitHub {
    owner = "Tygs";
    repo = "0bin";
    rev = "v${version}";
    sha256 = "1dfy3h823ylz4w2vv3mrmnmiyvf6rvyvsp4j3llr074w9id0zy16";
  };

  disabled = python3Packages.pythonOlder "3.7";

  nativeBuildInputs = [
    python3Packages.doit
    python3Packages.pyscss
    nodePackages.uglify-js
  ];

  propagatedBuildInputs = with python3Packages; [
    appdirs
    beaker
    bleach
    bottle
    clize
    lockfile
    paste
  ];

  prePatch = ''
    # replace /bin/bash in compress.sh
    patchShebangs .

    # relax version constraints of some dependencies
    substituteInPlace setup.cfg \
      --replace "clize==4.1.1" "clize" \
      --replace "bleach==3.1.5" "bleach>=3.1.5,<5" \
      --replace "bottle==0.12.18" "bottle>=0.12.18,<1" \
      --replace "Paste==3.4.3" "Paste>=3.4.3,<4"
  '';

  buildPhase = ''
    runHook preBuild
    doit build
    runHook postBuild
  '';

  # zerobin has no check, but checking would fail with:
  # nix_run_setup runserver: Received extra arguments: test
  # See https://github.com/NixOS/nixpkgs/pull/98734#discussion_r495823510
  doCheck = false;

  pythonImportsCheck = [ "zerobin" ];

  meta = with lib; {
    description = "A client side encrypted pastebin";
    homepage = "https://0bin.net/";
    license = licenses.wtfpl;
    platforms = platforms.all;
    maintainers = with maintainers; [ julm ];
  };
}