about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/lynis
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/lynis')
-rw-r--r--nixpkgs/pkgs/tools/security/lynis/default.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/lynis/default.nix b/nixpkgs/pkgs/tools/security/lynis/default.nix
new file mode 100644
index 000000000000..d207e3d6e3e0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/lynis/default.nix
@@ -0,0 +1,39 @@
+{ lib, stdenv, makeWrapper, fetchFromGitHub, gawk, installShellFiles }:
+
+stdenv.mkDerivation rec {
+  pname = "lynis";
+  version = "3.1.1";
+
+  src = fetchFromGitHub {
+    owner = "CISOfy";
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-DdsBGISKZuqDwSeuy8/73qskP3XoO3QRT7+bkKIJcBU=";
+  };
+
+  nativeBuildInputs = [ installShellFiles makeWrapper ];
+
+  postPatch = ''
+    grep -rl '/usr/local/lynis' ./ | xargs sed -i "s@/usr/local/lynis@$out/share/lynis@g"
+  '';
+
+  installPhase = ''
+    install -d $out/bin $out/share/lynis/plugins
+    cp -r include db default.prf $out/share/lynis/
+    cp -a lynis $out/bin
+    wrapProgram "$out/bin/lynis" --prefix PATH : ${lib.makeBinPath [ gawk ]}
+
+    installManPage lynis.8
+    installShellCompletion --bash --name lynis.bash \
+      extras/bash_completion.d/lynis
+  '';
+
+  meta = with lib; {
+    description = "Security auditing tool for Linux, macOS, and UNIX-based systems";
+    mainProgram = "lynis";
+    homepage = "https://cisofy.com/lynis/";
+    license = licenses.gpl3Only;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.ryneeverett ];
+  };
+}