2020-04-24 23:36:52 +00:00
|
|
|
{ lib, python3Packages, fetchFromGitHub }:
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
let
|
|
|
|
inherit (python3Packages) buildPythonApplication pythonOlder;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPythonApplication rec {
|
|
|
|
pname = "pwgen-secure";
|
|
|
|
version = "0.9.1";
|
|
|
|
|
|
|
|
# it needs `secrets` which was introduced in 3.6
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
|
|
|
# GH is newer than Pypi and contains both library *and* the actual program
|
|
|
|
# whereas Pypi only has the library
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mjmunger";
|
|
|
|
repo = "pwgen_secure";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "15md5606hzy1xfhj2lxmc0nvynyrcs4vxa5jdi34kfm31rdklj28";
|
|
|
|
};
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
postPatch = ''
|
|
|
|
shareDir=$out/share/${pname}
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
substituteInPlace spwgen.py \
|
|
|
|
--replace-fail ' \ ' ' \\ '
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
substituteInPlace pwgen_secure/rpg.py \
|
2024-09-19 14:19:46 +00:00
|
|
|
--replace-fail "os.path.join(path, 'words.txt')" "os.path.join('$shareDir', 'words.txt')"
|
2022-03-05 16:20:37 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3Packages; [ docopt ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2022-03-05 16:20:37 +00:00
|
|
|
install -Dm555 spwgen.py $out/bin/spwgen
|
|
|
|
install -Dm444 pwgen_secure/words.txt -t $shareDir
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# there are no checks
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Secure password generation library to replace pwgen";
|
|
|
|
homepage = "https://github.com/mjmunger/pwgen_secure/";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
2022-03-05 16:20:37 +00:00
|
|
|
mainProgram = "spwgen";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|