mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 00:08:32 +01:00
4a7f99d55d
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
34 lines
1.2 KiB
Nix
34 lines
1.2 KiB
Nix
{ stdenv, fetchurl, perlPackages, lib, runCommand, postfix }:
|
|
|
|
let
|
|
mk-perl-flags = inputs: lib.concatStringsSep " " (map (dep: "-I ${dep}/${perlPackages.perl.libPrefix}") inputs);
|
|
postgrey-flags = mk-perl-flags (with perlPackages; [
|
|
NetServer BerkeleyDB DigestSHA1 NetAddrIP IOMultiplex
|
|
]);
|
|
policy-test-flags = mk-perl-flags (with perlPackages; [
|
|
ParseSyslog
|
|
]);
|
|
version = "1.37";
|
|
name = "postgrey-${version}";
|
|
in runCommand name {
|
|
src = fetchurl {
|
|
url = "https://postgrey.schweikert.ch/pub/${name}.tar.gz";
|
|
sha256 = "1xx51xih4711vrvc6d57il9ccallbljj5zhgqdb07jzmz11rakgz";
|
|
};
|
|
meta = with lib; {
|
|
description = "A postfix policy server to provide greylisting";
|
|
homepage = "https://postgrey.schweikert.ch/";
|
|
platforms = postfix.meta.platforms;
|
|
license = licenses.gpl2;
|
|
};
|
|
} ''
|
|
mkdir -p $out/bin
|
|
cd $out
|
|
tar -xzf $src --strip-components=1
|
|
mv postgrey policy-test bin
|
|
sed -i -e "s,#!/usr/bin/perl -T,#!${perlPackages.perl}/bin/perl -T ${postgrey-flags}," \
|
|
-e "s#/etc/postfix#$out#" \
|
|
bin/postgrey
|
|
sed -i -e "s,#!/usr/bin/perl,#!${perlPackages.perl}/bin/perl ${policy-test-flags}," \
|
|
bin/policy-test
|
|
''
|