From 931eaa341c6b56f64ae8206278da8403cda20de6 Mon Sep 17 00:00:00 2001 From: Joachim Fasting Date: Thu, 2 Apr 2015 18:03:01 +0200 Subject: [PATCH] philter: reimplement using mkDerivation --- pkgs/tools/networking/philter/default.nix | 65 +++++++---------------- 1 file changed, 19 insertions(+), 46 deletions(-) diff --git a/pkgs/tools/networking/philter/default.nix b/pkgs/tools/networking/philter/default.nix index af5b9aacffcc..3d5ed7b34cae 100644 --- a/pkgs/tools/networking/philter/default.nix +++ b/pkgs/tools/networking/philter/default.nix @@ -1,57 +1,30 @@ -x@{builderDefsPackage - , python, makeWrapper - , ...}: -builderDefsPackage -(a : -let - helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ - []; +{ stdenv, fetchurl, python }: - buildInputs = map (n: builtins.getAttr n x) - (builtins.attrNames (builtins.removeAttrs x helperArgNames)); - sourceInfo = rec { - baseName="philter"; - version="1.1"; - name="${baseName}-${version}"; - url="mirror://sourceforge/${baseName}/${name}.tar.gz"; - hash="177pqfflhdn2mw9lc1wv9ik32ji69rjqr6dw83hfndwlsva5151l"; - }; -in -rec { - src = a.fetchurl { - url = sourceInfo.url; - sha256 = sourceInfo.hash; +stdenv.mkDerivation rec { + name = "philter-${version}"; + version = "1.1"; + src = fetchurl { + url = "mirror://sourceforge/philter/${name}.tar.gz"; + sha256 = "177pqfflhdn2mw9lc1wv9ik32ji69rjqr6dw83hfndwlsva5151l"; }; - inherit (sourceInfo) name version; - inherit buildInputs; + installPhase = '' + mkdir -p "$out"/{bin,share/philter} + cp .philterrc "$out"/share/philter/philterrc + sed -i 's@/usr/local/bin@${python}/bin@' src/philter.py + cp src/philter.py "$out"/bin/philter + chmod +x "$out"/bin/philter + ''; - /* doConfigure should be removed if not needed */ - phaseNames = ["installProgram" "patchShebangs" "wrapBinContentsPython"]; - patchShebangs = (a.doPatchShebangs "$out/bin"); - - installProgram = a.fullDepEntry('' - mv "$out/share/philter/".*rc "$out/share/philter/philterrc" - mkdir -p "$out/bin" - cp "$out/share/philter/src/philter.py" "$out/bin/philter" - chmod a+x "$out/bin/philter" - '') ["addInputs" "copyToShare" "minInit"]; - - copyToShare = (a.simplyShare "philter"); - - meta = { + meta = with stdenv.lib; { description = "Mail sorter for Maildirs"; - maintainers = with a.lib.maintainers; - [ - raskin - ]; - platforms = with a.lib.platforms; - linux; + maintainers = with maintainers; [ raskin ]; + platforms = with platforms; linux; }; + passthru = { updateInfo = { downloadPage = "http://philter.sourceforge.net/"; }; }; -}) x - +}