From 2169faee8babbec370429410eb26fa85aaf1baf4 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 10 May 2019 07:49:09 +0200 Subject: [PATCH 1/3] byacc: resulting binary should be named `byacc` --- pkgs/development/tools/parsing/byacc/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/tools/parsing/byacc/default.nix b/pkgs/development/tools/parsing/byacc/default.nix index ba1b8f27e7c..4e73c820912 100644 --- a/pkgs/development/tools/parsing/byacc/default.nix +++ b/pkgs/development/tools/parsing/byacc/default.nix @@ -12,8 +12,16 @@ stdenv.mkDerivation rec { sha256 = "173l9yai5yndbyn8nzdl6q11wv4x959bd0w392i82nfsqcz0pfsv"; }; + configureFlags = [ + "--program-transform-name='s,^,b,'" + ]; + doCheck = true; + postInstall = '' + ln -s $out/bin/byacc $out/bin/yacc + ''; + meta = with stdenv.lib; { description = "Berkeley YACC"; homepage = https://invisible-island.net/byacc/byacc.html; From ecafe8a7afe8b858557a98817e076d5cf8dbe6dd Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 6 May 2019 15:49:46 +0200 Subject: [PATCH 2/3] zmap: init at 2.1.1 zmap[1] is a fast network scanner for the IPv4 address space. This is the main package of the ZMap projects, there are further one that will be packaged soon. [1] https://zmap.io/ --- pkgs/tools/security/zmap/default.nix | 32 ++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/tools/security/zmap/default.nix diff --git a/pkgs/tools/security/zmap/default.nix b/pkgs/tools/security/zmap/default.nix new file mode 100644 index 00000000000..f98b4295e9e --- /dev/null +++ b/pkgs/tools/security/zmap/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchFromGitHub, cmake, pkgconfig, libjson, json_c, gengetopt, flex, byacc, gmp +, libpcap +}: + +stdenv.mkDerivation rec { + pname = "zmap"; + version = "2.1.1"; + + src = fetchFromGitHub { + owner = "zmap"; + repo = pname; + rev = "v${version}"; + sha256 = "0yaahaiawkjk020hvsb8pndbrk8k10wxkfba1irp12a4sj6rywcs"; + }; + + cmakeFlags = [ "-DRESPECT_INSTALL_PREFIX_CONFIG=ON" ]; + dontUseCmakeBuildDir = true; + + nativeBuildInputs = [ cmake pkgconfig gengetopt flex byacc ]; + buildInputs = [ libjson json_c gmp libpcap ]; + + outputs = [ "out" "man" ]; + + meta = with stdenv.lib; { + homepage = https://zmap.io/; + license = licenses.asl20; + description = "Fast single packet network scanner designed for Internet-wide network surveys"; + maintainers = with maintainers; [ ma27 ]; + platforms = platforms.unix; + broken = stdenv.isDarwin; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 701342281fe..2f7873b7a97 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6811,6 +6811,8 @@ in zxing = callPackage ../tools/graphics/zxing {}; + zmap = callPackage ../tools/security/zmap { }; + ### SHELLS From 3d6fe3d7600c4495abc435bf34f98edb9e59e232 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 10 May 2019 08:12:27 +0200 Subject: [PATCH 3/3] nixos/zmap: init module The module installs `zmap` globally and links the config files to `/etc/zmap`, the default location of config files for zmap. The package provides pretty much a sensitive default, custom configs can be created like this: ``` { lib, ... }: { environment.etc."zmap/blacklist.conf" = lib.mkForce { text = '' # custom zmap blacklist 0.0.0.0/0 ''; }; } ``` --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/zmap.nix | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 nixos/modules/programs/zmap.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index a07461022a3..b8d3c924513 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -144,6 +144,7 @@ ./programs/xonsh.nix ./programs/xss-lock.nix ./programs/yabar.nix + ./programs/zmap.nix ./programs/zsh/oh-my-zsh.nix ./programs/zsh/zsh.nix ./programs/zsh/zsh-autoenv.nix diff --git a/nixos/modules/programs/zmap.nix b/nixos/modules/programs/zmap.nix new file mode 100644 index 00000000000..2e27fce4d7c --- /dev/null +++ b/nixos/modules/programs/zmap.nix @@ -0,0 +1,18 @@ +{ pkgs, config, lib, ... }: + +with lib; + +let + cfg = config.programs.zmap; +in { + options.programs.zmap = { + enable = mkEnableOption "ZMap"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.zmap ]; + + environment.etc."zmap/blacklist.conf".source = "${pkgs.zmap}/etc/zmap/blacklist.conf"; + environment.etc."zmap/zmap.conf".source = "${pkgs.zmap}/etc/zmap.conf"; + }; +}