about summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien@users.noreply.github.com>2022-06-05 17:30:34 +0000
committerGitHub <noreply@github.com>2022-06-05 17:30:34 +0000
commit7548b711384e6214787a6615fbd3be3b968fc430 (patch)
treee2f9679c603bcdd747c14414e7da5d04cee07497 /pkgs/misc
parent4697dffd3c48522c22e8384ad95ead3af5180e25 (diff)
parentd7432b815d0e08634d0a5e4f56f42fc18cbd38e9 (diff)
Merge pull request #171778 from zhaofengli/infnoise-0.3.2
infnoise: unstable-2019-08-12 -> 0.3.2, nixos/infnoise: init
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/drivers/infnoise/default.nix43
-rw-r--r--pkgs/misc/drivers/infnoise/makefile.patch4
2 files changed, 32 insertions, 15 deletions
diff --git a/pkgs/misc/drivers/infnoise/default.nix b/pkgs/misc/drivers/infnoise/default.nix
index b64cb56c40760..47ff00459923f 100644
--- a/pkgs/misc/drivers/infnoise/default.nix
+++ b/pkgs/misc/drivers/infnoise/default.nix
@@ -1,43 +1,60 @@
-{ lib, stdenv, fetchFromGitHub, libftdi }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, libftdi
+, infnoise, testers }:
 
 stdenv.mkDerivation rec {
   pname = "infnoise";
-  version = "unstable-2019-08-12";
+  version = "0.3.2";
 
   src = fetchFromGitHub {
-    owner = "13-37-org";
+    owner = "leetronics";
     repo = "infnoise";
-    rev = "132683d4b5ce0902468b666cba63baea36e97f0c";
-    sha256 = "1dzfzinyvhyy9zj32kqkl19fyhih6sy8r5sa3qahbbr4c30k7flp";
+    rev = "e80ddd78085abf3d06df2e0d8c08fd33dade78eb";
+    sha256 = "sha256-9MKG1InkV+yrQPBTgi2gZJ3y9Fokb6WbxuAnM7n7FyA=";
   };
 
-  # Patch makefile so we can set defines from the command line instead of it depending on .git
-  patches = [ ./makefile.patch ];
+  patches = [
+    # Patch makefile so we can set defines from the command line instead of it depending on .git
+    ./makefile.patch
+
+    # Fix getc return type
+    (fetchpatch {
+      url = "https://github.com/leetronics/infnoise/commit/7ed7014e14253311c07e530c8f89f1c8f4705c2b.patch";
+      sha256 = "sha256-seB/fJaxQ/rXJp5iPtnobXXOccQ2KUAk6HFx31dhOhs=";
+    })
+  ];
+
   GIT_COMMIT = src.rev;
   GIT_VERSION = version;
   GIT_DATE = "2019-08-12";
 
   buildInputs = [ libftdi ];
 
-  sourceRoot = "source/software";
   makefile = "Makefile.linux";
   makeFlags = [ "PREFIX=$(out)" ];
   postPatch = ''
+    cd software
     substituteInPlace init_scripts/infnoise.service --replace "/usr/local" "$out"
   '';
 
+  postInstall = ''
+    make -C tools
+    find ./tools/ -executable -type f -exec \
+      sh -c "install -Dm755 {} $out/bin/infnoise-\$(basename {})" \;
+  '';
+
+  passthru = {
+    tests.version = testers.testVersion { package = infnoise; };
+  };
+
   meta = with lib; {
-    homepage = "https://github.com/13-37-org/infnoise";
+    homepage = "https://github.com/leetronics/infnoise";
     description = "Driver for the Infinite Noise TRNG";
     longDescription = ''
       The Infinite Noise TRNG is a USB key hardware true random number generator.
       It can either provide rng for userland applications, or provide rng for the OS entropy.
-      Add the following to your system configuration for plug and play support, adding to the OS entropy:
-      systemd.packages = [ pkgs.infnoise ];
-      services.udev.packages = [ pkgs.infnoise ];
     '';
     license = licenses.cc0;
-    maintainers = with maintainers; [ StijnDW ];
+    maintainers = with maintainers; [ StijnDW zhaofengli ];
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/misc/drivers/infnoise/makefile.patch b/pkgs/misc/drivers/infnoise/makefile.patch
index b38519036d2c3..871a6c508ce65 100644
--- a/pkgs/misc/drivers/infnoise/makefile.patch
+++ b/pkgs/misc/drivers/infnoise/makefile.patch
@@ -1,7 +1,7 @@
 diff --git a/software/Makefile.linux b/software/Makefile.linux
 index db48aa5..df8b3d2 100644
---- a/Makefile.linux
-+++ b/Makefile.linux
+--- a/software/Makefile.linux
++++ b/software/Makefile.linux
 @@ -1,6 +1,6 @@
 -GIT_VERSION := $(shell git --no-pager describe --tags --always)
 -GIT_COMMIT  := $(shell git rev-parse --verify HEAD)