nixpkgs-suyu/pkgs/tools/security/pass/extensions/audit/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

53 lines
1.5 KiB
Nix

{ lib, stdenv, pass, fetchFromGitHub, pythonPackages, makeWrapper, gnupg }:
let
pythonEnv = pythonPackages.python.withPackages (p: [ p.requests p.setuptools p.zxcvbn ]);
in stdenv.mkDerivation rec {
pname = "pass-audit";
version = "1.1";
src = fetchFromGitHub {
owner = "roddhjav";
repo = "pass-audit";
rev = "v${version}";
sha256 = "1vapymgpab91kh798mirgs1nb7j9qln0gm2d3321cmsghhb7xs45";
};
patches = [
./0002-Fix-audit.bash-setup.patch
];
postPatch = ''
substituteInPlace audit.bash \
--replace 'python3' "${pythonEnv}/bin/python3"
substituteInPlace Makefile \
--replace "install --root" "install --prefix ''' --root"
'';
outputs = [ "out" "man" ];
buildInputs = [ pythonEnv ];
nativeBuildInputs = [ makeWrapper ];
# Tests freeze on darwin with: pass-audit-1.1 (checkPhase): EOFError
doCheck = !stdenv.isDarwin;
checkInputs = [ pythonPackages.green pass gnupg ];
checkPhase = ''
${pythonEnv}/bin/python3 setup.py green -q
'';
installFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" ];
postInstall = ''
wrapProgram $out/lib/password-store/extensions/audit.bash \
--prefix PYTHONPATH : "$out/lib/${pythonEnv.libPrefix}/site-packages"
'';
meta = with lib; {
description = "Pass extension for auditing your password repository.";
homepage = "https://github.com/roddhjav/pass-audit";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ ma27 ];
};
}