patch getentropy (#388)

* bump nixpkgs

* patch entropy

* bump haskell.nix

* remove file

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
This commit is contained in:
Evgeny Poberezkin 2022-03-01 07:01:52 +00:00 committed by GitHub
parent b19cf35d28
commit 42faa2e75b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 41 deletions

30
entropy.patch Normal file
View file

@ -0,0 +1,30 @@
diff --git a/cbits/random_initialized.c b/cbits/random_initialized.c
index 36ac968..ab708b0 100644
--- a/cbits/random_initialized.c
+++ b/cbits/random_initialized.c
@@ -5,14 +5,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#ifdef HAVE_GETENTROPY
-static int ensure_pool_initialized_getentropy()
-{
- char tmp;
- return getentropy(&tmp, sizeof(tmp));
-}
-#endif
-
// Poll /dev/random to wait for randomness. This is a proxy for the /dev/urandom
// pool being initialized.
static int ensure_pool_initialized_poll()
@@ -45,10 +37,5 @@ static int ensure_pool_initialized_poll()
// Returns 0 on success, non-zero on failure.
int ensure_pool_initialized()
{
-#ifdef HAVE_GETENTROPY
- if (ensure_pool_initialized_getentropy() == 0)
- return 0;
-#endif
-
return ensure_pool_initialized_poll();
}

78
flake.lock generated
View file

@ -20,10 +20,10 @@
"flake": false,
"locked": {
"lastModified": 1603716527,
"narHash": "sha256-sDbrmur9Zfp4mPKohCD8IDZfXJ0Tjxpmr2R+kg5PpSY=",
"narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=",
"owner": "haskell",
"repo": "cabal",
"rev": "94aaa8e4720081f9c75497e2735b90f6a819b08e",
"rev": "48bf10787e27364730dd37a42b603cee8d6af7ee",
"type": "github"
},
"original": {
@ -36,11 +36,11 @@
"cabal-34": {
"flake": false,
"locked": {
"lastModified": 1622475795,
"narHash": "sha256-chwTL304Cav+7p38d9mcb+egABWmxo2Aq+xgVBgEb/U=",
"lastModified": 1640353650,
"narHash": "sha256-N1t6M3/wqj90AEdRkeC8i923gQYUpzSr8b40qVOZ1Rk=",
"owner": "haskell",
"repo": "cabal",
"rev": "b086c1995cdd616fc8d91f46a21e905cc50a1049",
"rev": "942639c18c0cd8ec53e0a6f8d120091af35312cd",
"type": "github"
},
"original": {
@ -53,11 +53,11 @@
"cabal-36": {
"flake": false,
"locked": {
"lastModified": 1640163203,
"narHash": "sha256-TwDWP2CffT0j40W6zr0J1Qbu+oh3nsF1lUx9446qxZM=",
"lastModified": 1641652457,
"narHash": "sha256-BlFPKP4C4HRUJeAbdembX1Rms1LD380q9s0qVDeoAak=",
"owner": "haskell",
"repo": "cabal",
"rev": "ecf418050c1821f25e2e218f1be94c31e0465df1",
"rev": "f27667f8ec360c475027dcaee0138c937477b070",
"type": "github"
},
"original": {
@ -100,11 +100,11 @@
},
"flake-utils_2": {
"locked": {
"lastModified": 1623875721,
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
@ -133,11 +133,11 @@
"hackage": {
"flake": false,
"locked": {
"lastModified": 1642986764,
"narHash": "sha256-U6FPiNjz9JctwKC838LEoT/xjGfb8L18ZGIEY5YYzdU=",
"lastModified": 1646097829,
"narHash": "sha256-PcHDDV8NuUxZhPV/p++IkZC+SDZ1Db7m7K+9HN4/0S4=",
"owner": "input-output-hk",
"repo": "hackage.nix",
"rev": "22406c79a506164c4e835a68e54739f63f918784",
"rev": "283f096976b48e54183905e7bdde7f213c6ee5cd",
"type": "github"
},
"original": {
@ -169,16 +169,16 @@
"stackage": "stackage"
},
"locked": {
"lastModified": 1643019329,
"narHash": "sha256-So77czYvvD0jt4GJeypkqw3VNn20ype5tHnHri2s5lg=",
"lastModified": 1646102369,
"narHash": "sha256-eorqNxNiAbOMqm+juJNiqJ+zABP+JpHEh2f7rbf2Ss0=",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "ddc654e2e7e44617bfc17a5aed2a0947d3e192cc",
"rev": "d8cbc9af7750bb751255d90bc17d54e0afba3d63",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"ref": "angerman/android-static",
"ref": "angerman/try-no-libcharset",
"repo": "haskell.nix",
"type": "github"
}
@ -202,11 +202,11 @@
"nix-tools": {
"flake": false,
"locked": {
"lastModified": 1636018067,
"narHash": "sha256-ng306fkuwr6V/malWtt3979iAC4yMVDDH2ViwYB6sQE=",
"lastModified": 1644395812,
"narHash": "sha256-BVFk/BEsTLq5MMZvdy3ZYHKfaS3dHrsKh4+tb5t5b58=",
"owner": "input-output-hk",
"repo": "nix-tools",
"rev": "ed5bd7215292deba55d6ab7a4e8c21f8b1564dda",
"rev": "d847c63b99bbec78bf83be2a61dc9f09b8a9ccc1",
"type": "github"
},
"original": {
@ -217,16 +217,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1641457028,
"narHash": "sha256-bA31xSpdSIo+rJMbHPurlxIsP/b6bbN+jvXOqyn2lR8=",
"owner": "angerman",
"lastModified": 1645623357,
"narHash": "sha256-vAaI91QFn/kY/uMiebW+kG2mPmxirMSJWYtkqkBKdDc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7b049e87e9b371f9ea6648aa8f1f2d17b2e31ae5",
"rev": "9222ae36b208d1c6b55d88e10aa68f969b5b5244",
"type": "github"
},
"original": {
"owner": "angerman",
"ref": "patch-1",
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -249,11 +249,11 @@
},
"nixpkgs-2105": {
"locked": {
"lastModified": 1640283157,
"narHash": "sha256-6Ddfop+rKE+Gl9Tjp9YIrkfoYPzb8F80ergdjcq3/MY=",
"lastModified": 1642244250,
"narHash": "sha256-vWpUEqQdVP4srj+/YLJRTN9vjpTs4je0cdWKXPbDItc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dde1557825c5644c869c5efc7448dc03722a8f09",
"rev": "0fd9ee1aa36ce865ad273f4f07fdc093adeb5c00",
"type": "github"
},
"original": {
@ -265,11 +265,11 @@
},
"nixpkgs-2111": {
"locked": {
"lastModified": 1640283207,
"narHash": "sha256-SCwl7ZnCfMDsuSYvwIroiAlk7n33bW8HFfY8NvKhcPA=",
"lastModified": 1644510859,
"narHash": "sha256-xjpVvL5ecbyi0vxtVl/Fh9bwGlMbw3S06zE5nUzFB8A=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "64c7e3388bbd9206e437713351e814366e0c3284",
"rev": "0d1d5d7e3679fec9d07f2eb804d9f9fdb98378d3",
"type": "github"
},
"original": {
@ -281,11 +281,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1641285291,
"narHash": "sha256-KYaOBNGar3XWTxTsYPr9P6u74KAqNq0wobEC236U+0c=",
"lastModified": 1644486793,
"narHash": "sha256-EeijR4guVHgVv+JpOX3cQO+1XdrkJfGmiJ9XVsVU530=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0432195a4b8d68faaa7d3d4b355260a3120aeeae",
"rev": "1882c6b7368fd284ad01b0a5b5601ef136321292",
"type": "github"
},
"original": {
@ -322,11 +322,11 @@
"stackage": {
"flake": false,
"locked": {
"lastModified": 1642986888,
"narHash": "sha256-oxG7LzlJdjKTJgSv7diKWsGTETDZMPT2mNNLbrBfiVs=",
"lastModified": 1646010978,
"narHash": "sha256-NpioQiTXyYm+Gm111kcDEE/ghflmnTNwPhWff54GYA4=",
"owner": "input-output-hk",
"repo": "stackage.nix",
"rev": "aeaf5fe21874f01702f394d01e18f472be6e3e08",
"rev": "9cce3e0d420f6c38cdbbe1c5e5bbc07fd2adfc3a",
"type": "github"
},
"original": {

View file

@ -1,7 +1,7 @@
{
description = "nix flake for simplex-chat";
inputs.nixpkgs.url = "github:angerman/nixpkgs/patch-1"; # based on 21.11, still need this, until everything is merged into 21.11.
inputs.haskellNix.url = "github:input-output-hk/haskell.nix?ref=angerman/android-static";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; #angerman/nixpkgs/patch-1"; # based on 21.11, still need this, until everything is merged into 21.11.
inputs.haskellNix.url = "github:input-output-hk/haskell.nix?ref=angerman/try-no-libcharset";
inputs.haskellNix.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, haskellNix, nixpkgs, flake-utils }:
@ -21,6 +21,7 @@
sha256map = import ./sha256map.nix;
modules = [{
packages.direct-sqlite.patches = [ ./direct-sqlite-2.3.26.patch ];
packages.entropy.patches = [ ./entropy.patch ];
}
({ pkgs,lib, ... }: lib.mkIf (pkgs.stdenv.hostPlatform.isAndroid) {
packages.simplex-chat.components.library.ghcOptions = [ "-pie" ];