nixpkgs/pkgs/by-name/bu/buku/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

88 lines
2.1 KiB
Nix

{ lib, python3, fetchFromGitHub, withServer ? false }:
let
serverRequire = with python3.pkgs; [
requests
flask
flask-admin
flask-api
flask-bootstrap
flask-paginate
flask-wtf
arrow
werkzeug
click
vcrpy
toml
];
in
with python3.pkgs; buildPythonApplication rec {
version = "4.8";
pname = "buku";
pyproject = true;
src = fetchFromGitHub {
owner = "jarun";
repo = "buku";
rev = "v${version}";
sha256 = "sha256-kPVlfTYUusf5CZnKB53WZcCHo3MEnA2bLUHTRPGPn+8=";
};
nativeBuildInputs = [
setuptools
];
nativeCheckInputs = [
hypothesis
pytest
pytest-recording
pyyaml
mypy-extensions
click
pylint
flake8
pytest-cov
pyyaml
];
propagatedBuildInputs = [
cryptography
beautifulsoup4
certifi
urllib3
html5lib
] ++ lib.optionals withServer serverRequire;
preCheck = ''
# Disables a test which requires internet
substituteInPlace tests/test_bukuDb.py \
--replace "@pytest.mark.slowtest" "@unittest.skip('skipping')" \
--replace "self.assertEqual(shorturl, \"http://tny.im/yt\")" "" \
--replace "self.assertEqual(url, \"https://www.google.com\")" ""
substituteInPlace setup.py \
--replace mypy-extensions==0.4.1 mypy-extensions>=0.4.1
'' + lib.optionalString (!withServer) ''
rm tests/test_{server,views}.py
'';
postInstall = ''
make install PREFIX=$out
mkdir -p $out/share/zsh/site-functions $out/share/bash-completion/completions $out/share/fish/vendor_completions.d
cp auto-completion/zsh/* $out/share/zsh/site-functions
cp auto-completion/bash/* $out/share/bash-completion/completions
cp auto-completion/fish/* $out/share/fish/vendor_completions.d
'' + lib.optionalString (!withServer) ''
rm $out/bin/bukuserver
'';
meta = with lib; {
description = "Private cmdline bookmark manager";
mainProgram = "buku";
homepage = "https://github.com/jarun/Buku";
license = licenses.gpl3;
platforms = platforms.unix;
maintainers = with maintainers; [ matthiasbeyer ];
};
}