nixpkgs/pkgs/tools/security/fwknop/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

63 lines
1.9 KiB
Nix

{ lib, stdenv, fetchFromGitHub, autoreconfHook
, libpcap, texinfo
, iptables
, gnupgSupport ? true, gnupg, gpgme # Increases dependencies!
, wgetSupport ? true, wget
, buildServer ? true
, buildClient ? true }:
stdenv.mkDerivation rec {
pname = "fwknop";
version = "2.6.10";
src = fetchFromGitHub {
owner = "mrash";
repo = pname;
rev = version;
sha256 = "05kvqhmxj9p2y835w75f3jvhr38bb96cd58mvfd7xil9dhmhn9ra";
};
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ libpcap texinfo ]
++ stdenv.lib.optionals gnupgSupport [ gnupg gpgme.dev ]
++ stdenv.lib.optionals wgetSupport [ wget ];
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/run"
"--with-iptables=${iptables}/sbin/iptables"
(stdenv.lib.enableFeature buildServer "server")
(stdenv.lib.enableFeature buildClient "client")
(stdenv.lib.withFeatureAs wgetSupport "wget" "${wget}/bin/wget")
] ++ stdenv.lib.optionalString gnupgSupport [
"--with-gpgme"
"--with-gpgme-prefix=${gpgme.dev}"
"--with-gpg=${gnupg}"
];
# Temporary hack to copy the example configuration files into the nix-store,
# this'll probably be helpful until there's a NixOS module for that (feel free
# to ping me (@primeos) if you want to help).
preInstall = ''
substituteInPlace Makefile --replace\
"sysconfdir = /etc"\
"sysconfdir = $out/etc"
substituteInPlace server/Makefile --replace\
"wknopddir = /etc/fwknop"\
"wknopddir = $out/etc/fwknop"
'';
meta = with lib; {
description =
"Single Packet Authorization (and Port Knocking) server/client";
longDescription = ''
fwknop stands for the "FireWall KNock OPerator", and implements an
authorization scheme called Single Packet Authorization (SPA).
'';
homepage = "https://www.cipherdyne.org/fwknop/";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ primeos ];
};
}