nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python3Packages,
4 fetchFromGitHub,
5 installShellFiles,
6 pandoc,
7 writableTmpDirAsHomeHook,
8}:
9
10python3Packages.buildPythonApplication rec {
11 pname = "pwdsphinx";
12 version = "2.0.3";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "stef";
17 repo = "pwdsphinx";
18 tag = "v${version}";
19 hash = "sha256-COSfA5QqIGWEnahmo5klFECK7XjyabGs1nG9vyhj/DM=";
20 };
21
22 postPatch = ''
23 substituteInPlace ./setup.py \
24 --replace-fail 'zxcvbn-python' 'zxcvbn'
25 '';
26
27 build-system = [ python3Packages.setuptools ];
28
29 dependencies = with python3Packages; [
30 cbor2
31 pyequihash
32 pyoprf
33 pysodium
34 qrcodegen
35 securestring
36 zxcvbn
37 ];
38
39 # for man pages
40 nativeBuildInputs = [
41 installShellFiles
42 pandoc
43 ];
44
45 postInstall = ''
46 mkdir -p $out/share/doc/pwdsphinx/
47 cp -r ./configs $out/share/doc/pwdsphinx/
48 installManPage man/*.1
49 '';
50
51 nativeCheckInputs = [
52 python3Packages.pytestCheckHook
53 writableTmpDirAsHomeHook
54 ];
55
56 preCheck = ''
57 mkdir -p ~/.config/sphinx
58 cp ${src}/configs/config ~/.config/sphinx/config
59 # command fails without key but the command generates the key, so always pass
60 $out/bin/sphinx init || true
61 '';
62
63 pythonImportsCheck = [ "pwdsphinx" ];
64
65 meta = {
66 description = "Native backend for web-extensions for Sphinx-based password storage";
67 homepage = "https://www.ctrlc.hu/~stef/blog/posts/sphinx.html";
68 downloadPage = "https://github.com/stef/pwdsphinx";
69 changelog = "https://github.com/stef/pwdsphinx/releases/tag/v${version}";
70 teams = [ lib.teams.ngi ];
71 license = lib.licenses.gpl3Plus;
72 mainProgram = "sphinx";
73 };
74}