nixpkgs/pkgs/misc/drivers/infnoise/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, fetchpatch, libftdi
2022-05-06 08:22:46 +01:00
, infnoise, testers }:
2021-04-10 20:50:34 +01:00
stdenv.mkDerivation rec {
pname = "infnoise";
2022-05-06 08:22:46 +01:00
version = "0.3.2";
2021-04-10 20:50:34 +01:00
src = fetchFromGitHub {
2022-05-06 08:22:46 +01:00
owner = "leetronics";
2021-04-10 20:50:34 +01:00
repo = "infnoise";
2022-05-06 08:22:46 +01:00
rev = "e80ddd78085abf3d06df2e0d8c08fd33dade78eb";
sha256 = "sha256-9MKG1InkV+yrQPBTgi2gZJ3y9Fokb6WbxuAnM7n7FyA=";
2021-04-10 20:50:34 +01:00
};
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=";
})
];
2021-04-10 20:50:34 +01:00
GIT_COMMIT = src.rev;
GIT_VERSION = version;
GIT_DATE = "2019-08-12";
buildInputs = [ libftdi ];
makefile = "Makefile.linux";
makeFlags = [ "PREFIX=$(out)" ];
postPatch = ''
cd software
2021-04-10 20:50:34 +01:00
substituteInPlace init_scripts/infnoise.service --replace "/usr/local" "$out"
'';
2022-05-06 08:22:46 +01:00
postInstall = ''
make -C tools
find ./tools/ -executable -type f -exec \
sh -c "install -Dm755 {} $out/bin/infnoise-\$(basename {})" \;
'';
2022-05-06 08:22:46 +01:00
passthru = {
tests.version = testers.testVersion { package = infnoise; };
};
2021-04-10 20:50:34 +01:00
meta = with lib; {
2022-05-06 08:22:46 +01:00
homepage = "https://github.com/leetronics/infnoise";
2021-04-10 20:50:34 +01:00
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.
'';
license = licenses.cc0;
2022-05-06 08:22:46 +01:00
maintainers = with maintainers; [ StijnDW zhaofengli ];
2021-04-10 20:50:34 +01:00
platforms = platforms.linux;
};
}