diff options
Diffstat (limited to 'pkgs/tools/security/pass/extensions/audit/default.nix')
-rw-r--r-- | pkgs/tools/security/pass/extensions/audit/default.nix | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/pkgs/tools/security/pass/extensions/audit/default.nix b/pkgs/tools/security/pass/extensions/audit/default.nix index 055af774a6245..d3f196a20563c 100644 --- a/pkgs/tools/security/pass/extensions/audit/default.nix +++ b/pkgs/tools/security/pass/extensions/audit/default.nix @@ -1,11 +1,16 @@ -{ lib, stdenv, pass, fetchFromGitHub, pythonPackages, makeWrapper, gnupg }: +{ + lib, + stdenv, + pass, + fetchFromGitHub, + python3, + gnupg, +}: -let - pythonEnv = pythonPackages.python.withPackages (p: [ p.requests p.setuptools p.zxcvbn ]); - -in stdenv.mkDerivation rec { +python3.pkgs.buildPythonApplication rec { pname = "pass-audit"; version = "1.2"; + pyproject = true; src = fetchFromGitHub { owner = "roddhjav"; @@ -21,30 +26,46 @@ in stdenv.mkDerivation rec { postPatch = '' substituteInPlace audit.bash \ - --replace-fail 'python3' "${pythonEnv.interpreter}" - substituteInPlace Makefile \ - --replace-fail "install --root" "install --prefix ''' --root" + --replace-fail python3 "${lib.getExe python3}" + rm Makefile + patchShebangs audit.bash ''; - outputs = [ "out" "man" ]; + outputs = [ + "out" + "man" + ]; - buildInputs = [ pythonEnv ]; - nativeBuildInputs = [ makeWrapper ]; + build-system = with python3.pkgs; [ setuptools ]; + dependencies = with python3.pkgs; [ + requests + setuptools + zxcvbn + ]; # Tests freeze on darwin with: pass-audit-1.1 (checkPhase): EOFError doCheck = !stdenv.isDarwin; - nativeCheckInputs = [ pythonPackages.green pass gnupg ]; + nativeCheckInputs = [ + python3.pkgs.green + pass + gnupg + ]; checkPhase = '' - ${pythonEnv.interpreter} -m green -q + python3 -m green -q ''; - installFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" ]; postInstall = '' + mkdir -p $out/lib/password-store/extensions + install -m777 audit.bash $out/lib/password-store/extensions/audit.bash + cp -r share $out/ + buildPythonPath "$out $dependencies" wrapProgram $out/lib/password-store/extensions/audit.bash \ - --prefix PYTHONPATH : "$out/${pythonEnv.sitePackages}" \ + --prefix PYTHONPATH : "$PYTHONPATH" \ --run "export COMMAND" ''; + pythonImportsCheck = [ "pass_audit" ]; + meta = with lib; { description = "Pass extension for auditing your password repository"; homepage = "https://github.com/roddhjav/pass-audit"; |