From f031bcacd12584060f34a459df3fd7149abe7bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 4 Jul 2023 12:06:17 +0200 Subject: [PATCH 01/14] Add a flake.nix that builds with haskell.nix --- flake.lock | 546 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 38 ++++ 2 files changed, 584 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fd63116 --- /dev/null +++ b/flake.lock @@ -0,0 +1,546 @@ +{ + "nodes": { + "HTTP": { + "flake": false, + "locked": { + "lastModified": 1451647621, + "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", + "owner": "phadej", + "repo": "HTTP", + "rev": "9bc0996d412fef1787449d841277ef663ad9a915", + "type": "github" + }, + "original": { + "owner": "phadej", + "repo": "HTTP", + "type": "github" + } + }, + "cabal-32": { + "flake": false, + "locked": { + "lastModified": 1603716527, + "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", + "owner": "haskell", + "repo": "cabal", + "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.2", + "repo": "cabal", + "type": "github" + } + }, + "cabal-34": { + "flake": false, + "locked": { + "lastModified": 1645834128, + "narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=", + "owner": "haskell", + "repo": "cabal", + "rev": "5ff598c67f53f7c4f48e31d722ba37172230c462", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.4", + "repo": "cabal", + "type": "github" + } + }, + "cabal-36": { + "flake": false, + "locked": { + "lastModified": 1669081697, + "narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=", + "owner": "haskell", + "repo": "cabal", + "rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.6", + "repo": "cabal", + "type": "github" + } + }, + "cardano-shell": { + "flake": false, + "locked": { + "lastModified": 1608537748, + "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", + "owner": "input-output-hk", + "repo": "cardano-shell", + "rev": "9392c75087cb9a3d453998f4230930dea3a95725", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "cardano-shell", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1672831974, + "narHash": "sha256-z9k3MfslLjWQfnjBtEtJZdq3H7kyi2kQtUThfTgdRk0=", + "owner": "input-output-hk", + "repo": "flake-compat", + "rev": "45f2638735f8cdc40fe302742b79f248d23eb368", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "hkm/gitlab-fix", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1679360468, + "narHash": "sha256-LGnza3cfXF10Biw3ZTg0u9o9t7s680Ww200t5KkHTh8=", + "owner": "hamishmack", + "repo": "flake-utils", + "rev": "e1ea268ff47ad475443dbabcd54744b4e5b9d4f5", + "type": "github" + }, + "original": { + "owner": "hamishmack", + "ref": "hkm/nested-hydraJobs", + "repo": "flake-utils", + "type": "github" + } + }, + "ghc-8.6.5-iohk": { + "flake": false, + "locked": { + "lastModified": 1600920045, + "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", + "owner": "input-output-hk", + "repo": "ghc", + "rev": "95713a6ecce4551240da7c96b6176f980af75cae", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "release/8.6.5-iohk", + "repo": "ghc", + "type": "github" + } + }, + "hackage": { + "flake": false, + "locked": { + "lastModified": 1688430724, + "narHash": "sha256-1+7TdZdr0v5PEttAbhBdMnfQWTTr42tDsKsFuE2pIpg=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "f23ead9c62542c2abdd68970ada00b4ce1cce941", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskellNix": { + "inputs": { + "HTTP": "HTTP", + "cabal-32": "cabal-32", + "cabal-34": "cabal-34", + "cabal-36": "cabal-36", + "cardano-shell": "cardano-shell", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_2", + "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", + "hackage": "hackage", + "hls-1.10": "hls-1.10", + "hls-2.0": "hls-2.0", + "hpc-coveralls": "hpc-coveralls", + "hydra": "hydra", + "iserv-proxy": "iserv-proxy", + "nixpkgs": [ + "haskellNix", + "nixpkgs-unstable" + ], + "nixpkgs-2003": "nixpkgs-2003", + "nixpkgs-2105": "nixpkgs-2105", + "nixpkgs-2111": "nixpkgs-2111", + "nixpkgs-2205": "nixpkgs-2205", + "nixpkgs-2211": "nixpkgs-2211", + "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-unstable": "nixpkgs-unstable", + "old-ghc-nix": "old-ghc-nix", + "stackage": "stackage" + }, + "locked": { + "lastModified": 1688431991, + "narHash": "sha256-lOfLzFvZfXkJuKOBxuf7KBxHyO4w1dDBLc+Kc0ITN5c=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "eb98796446a42551bc685065b296dba8f9241ca7", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, + "hls-1.10": { + "flake": false, + "locked": { + "lastModified": 1680000865, + "narHash": "sha256-rc7iiUAcrHxwRM/s0ErEsSPxOR3u8t7DvFeWlMycWgo=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "b08691db779f7a35ff322b71e72a12f6e3376fd9", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "1.10.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.0": { + "flake": false, + "locked": { + "lastModified": 1684398654, + "narHash": "sha256-RW44up2BIyBBYN6tZur5f9kDDR3kr0Rd+TgPbLTfwB4=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "20c6d1e731cd9c0beef7338e2fc7a8126ba9b6fb", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.0.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hpc-coveralls": { + "flake": false, + "locked": { + "lastModified": 1607498076, + "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", + "type": "github" + }, + "original": { + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "type": "github" + } + }, + "hydra": { + "inputs": { + "nix": "nix", + "nixpkgs": [ + "haskellNix", + "hydra", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671755331, + "narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=", + "owner": "NixOS", + "repo": "hydra", + "rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8", + "type": "github" + }, + "original": { + "id": "hydra", + "type": "indirect" + } + }, + "iserv-proxy": { + "flake": false, + "locked": { + "lastModified": 1670983692, + "narHash": "sha256-avLo34JnI9HNyOuauK5R69usJm+GfW3MlyGlYxZhTgY=", + "ref": "hkm/remote-iserv", + "rev": "50d0abb3317ac439a4e7495b185a64af9b7b9300", + "revCount": 10, + "type": "git", + "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + }, + "original": { + "ref": "hkm/remote-iserv", + "type": "git", + "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1661606874, + "narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=", + "owner": "NixOS", + "repo": "nix", + "rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "2.11.0", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1657693803, + "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2003": { + "locked": { + "lastModified": 1620055814, + "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-20.03-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2105": { + "locked": { + "lastModified": 1659914493, + "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-21.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2111": { + "locked": { + "lastModified": 1659446231, + "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-21.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2205": { + "locked": { + "lastModified": 1682600000, + "narHash": "sha256-ha4BehR1dh8EnXSoE1m/wyyYVvHI9txjW4w5/oxsW5Y=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "50fc86b75d2744e1ab3837ef74b53f103a9b55a0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2211": { + "locked": { + "lastModified": 1685314633, + "narHash": "sha256-8LXBPqTQXl5ofkjpJ18JcbmLJ/lWDoMxtUwiDYv0wro=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c8a17ce7abc03c50cd072e9e6c9b389c5f61836b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2305": { + "locked": { + "lastModified": 1685338297, + "narHash": "sha256-+Aq4O0Jn1W1q927ZHc3Zn6RO7bwQGmb6O8xYoGy0KrM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6287b47dbfabbb8bfbb9b1b53d198ad58a774de4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1685347552, + "narHash": "sha256-9woSppRyUFo26yUffORTzttJ+apOt8MmCv6RxpPNTU4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f2f1ec390714d303cf84ba086e34e45b450dd8c4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "old-ghc-nix": { + "flake": false, + "locked": { + "lastModified": 1631092763, + "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", + "owner": "angerman", + "repo": "old-ghc-nix", + "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", + "type": "github" + }, + "original": { + "owner": "angerman", + "ref": "master", + "repo": "old-ghc-nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "haskellNix": "haskellNix", + "nixpkgs": [ + "haskellNix", + "nixpkgs-unstable" + ] + } + }, + "stackage": { + "flake": false, + "locked": { + "lastModified": 1688429457, + "narHash": "sha256-N1syApmIUkEKe/L4JjOWdNwE52MO3T/pugps0m0Oj7o=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "437335c8c10933e4d9fc049bfcdfe99a74d3d23a", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..688b57e --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Chainweb Mining Client"; + inputs.haskellNix.url = "github:input-output-hk/haskell.nix"; + inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + outputs = { self, nixpkgs, flake-utils, haskellNix }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ haskellNix.overlay + (final: prev: { + # This overlay adds our project to pkgs + chainweb-mining-client = + final.haskell-nix.project' { + src = ./.; + compiler-nix-name = "ghc810"; + # This is used by `nix develop .` to open a shell for use with + # `cabal`, `hlint` and `haskell-language-server` + shell.tools = { + cabal = {}; + hlint = {}; + haskell-language-server = {}; + }; + # Non-Haskell shell tools go here + shell.buildInputs = with pkgs; [ + nixpkgs-fmt + ]; + # This adds `js-unknown-ghcjs-cabal` to the shell. + # shell.crossPlatforms = p: [p.ghcjs]; + }; + }) + ]; + pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; + flake = pkgs.chainweb-mining-client.flake {}; + in flake // { + # Built by `nix build .` + packages.default = flake.packages."chainweb-mining-client:exe:chainweb-mining-client"; + }); +} From 3b7988e5db7ebc1574d06ec00f0be4696b37c2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 4 Jul 2023 12:15:27 +0200 Subject: [PATCH 02/14] Add sha256 to deeproute source-repository-package --- cabal.project | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cabal.project b/cabal.project index 3103269..d2c9303 100644 --- a/cabal.project +++ b/cabal.project @@ -5,4 +5,5 @@ allow-newer: source-repository-package type: git location: https://github.com/kadena-io/deeproute.git - tag: 856be917bf162a769d9082c26700af4bdbb87d49 \ No newline at end of file + tag: 856be917bf162a769d9082c26700af4bdbb87d49 + --sha256: sha256-FHLl0gkwr+rtu42XBdVRD9k3bnhYl01GZAE0lz0V8wI= \ No newline at end of file From 9621bbe1e77fa1959df33ce4af67d3dc2b4def5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 4 Jul 2023 12:53:30 +0200 Subject: [PATCH 03/14] Fix compiler-nix-name --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 688b57e..55ea255 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ chainweb-mining-client = final.haskell-nix.project' { src = ./.; - compiler-nix-name = "ghc810"; + compiler-nix-name = "ghc8107"; # This is used by `nix develop .` to open a shell for use with # `cabal`, `hlint` and `haskell-language-server` shell.tools = { From 593e4bd701cc0f8bff83e668ef57e5002ef26190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 4 Jul 2023 12:54:38 +0200 Subject: [PATCH 04/14] Set uppoer bound on aeson MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the build fails with: [ 1 of 16] Compiling JsonRpc ( src/JsonRpc.hs, dist/build/chainweb-mining-client/chainweb-mining-client-tmp/JsonRpc.o, dist/build/chainweb-mining-client/chainweb-mining-client-tmp/JsonRpc.dyn_o ) src/JsonRpc.hs:162:22: error: • Expecting one more argument to ‘A.KeyValue kv’ Expected a constraint, but ‘A.KeyValue kv’ has kind ‘* -> Constraint’ • In the type signature: requestProperties :: A.KeyValue kv => A.ToJSON a => T.Text -> a -> Maybe MsgId -> [kv] | 162 | requestProperties :: A.KeyValue kv => A.ToJSON a => T.Text -> a -> Maybe MsgId -> [kv] | ^^^^^^^^^^^^^ --- chainweb-mining-client.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chainweb-mining-client.cabal b/chainweb-mining-client.cabal index a6cef11..45cf42f 100644 --- a/chainweb-mining-client.cabal +++ b/chainweb-mining-client.cabal @@ -72,7 +72,7 @@ executable chainweb-mining-client attoparsec >=0.14 , base >=4.10 && <5 , base16-bytestring >=1.0 - , aeson >=1.5 + , aeson >=1.5 && <2 , async >=2.2 , bytes >=0.17 , bytestring >=0.10 From 0af57c7fdbff0a7661db2890e2fa3c6e9e80c44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 4 Jul 2023 17:56:44 +0200 Subject: [PATCH 05/14] Convert default.nix as legacy wrapper for flake.nix --- default.nix | 55 +++++++---------------------------------------------- 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/default.nix b/default.nix index 0e219fc..f8164ed 100644 --- a/default.nix +++ b/default.nix @@ -1,48 +1,7 @@ -{ compiler ? "ghc8107" -, rev ? "7a94fcdda304d143f9a40006c033d7e190311b54" -, sha256 ? "0d643wp3l77hv2pmg2fi7vyxn4rwy0iyr8djcw1h5x72315ck9ik" -, pkgs ? - import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; - inherit sha256; }) { - config.allowBroken = false; # autodocodec - config.allowUnfree = true; - } -, mkDerivation ? null -}: -let gitignoreSrc = import (pkgs.fetchFromGitHub { - owner = "hercules-ci"; - repo = "gitignore"; - rev = "9e80c4d83026fa6548bc53b1a6fab8549a6991f6"; - sha256 = "04n9chlpbifgc5pa3zx6ff3rji9am6msrbn1z3x1iinjz2xjfp4p"; - }) {}; -in -pkgs.haskell.packages.${compiler}.developPackage { - name = builtins.baseNameOf ./.; - root = gitignoreSrc.gitignoreSource ./.; - - overrides = self: super: with pkgs.haskell.lib; { - configuration-tools = self.callHackageDirect { - pkg = "configuration-tools"; - ver = "0.6.1"; - sha256 = "0vrml1gj6bb5f6x79m80k9wqn5qvjjzz8c6gf36mqwdqv30irxdv"; - } {}; - - streaming-events = doJailbreak (self.callHackageDirect { - pkg = "streaming-events"; - ver = "1.0.1"; - sha256 = "11v9rrhvlxlq43m5pw63hdfn6n0fkqryphvplild1y920db96wk9"; - } {}); - - autodocodec = markUnbroken super.autodocodec; - validity-aeson = markUnbroken super.validity-aeson; - }; - source-overrides = { - }; - modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: { - buildTools = (attrs.buildTools or []) ++ [ - pkgs.haskell.packages.${compiler}.cabal-install - pkgs.haskell.packages.${compiler}.ghcid - ]; - }); -} +(import ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz"; + sha256 = "0jm6nzb83wa6ai17ly9fzpqc40wg1viib8klq8lby54agpl213w5"; } +) { + src = ./.; +}).defaultNix.packages.${builtins.currentSystem}.default From 4fd8782defd90ccbd4a9810f71049faf12710572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Fri, 3 Nov 2023 15:23:48 +0100 Subject: [PATCH 06/14] Switch to hs-nix-infra for pinning Haskell toolchain --- flake.lock | 546 +++++++++++++++-------------------------------------- flake.nix | 10 +- 2 files changed, 162 insertions(+), 394 deletions(-) diff --git a/flake.lock b/flake.lock index fd63116..f0b4d7b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,85 +1,18 @@ { "nodes": { - "HTTP": { + "empty": { "flake": false, "locked": { - "lastModified": 1451647621, - "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", - "owner": "phadej", - "repo": "HTTP", - "rev": "9bc0996d412fef1787449d841277ef663ad9a915", + "lastModified": 1683033565, + "narHash": "sha256-UZ2dz7/RzJKTw/8uqLu6biAbb3xNk23xUHb5/oAYWsw=", + "owner": "kadena-io", + "repo": "empty", + "rev": "c30c041f692678788a294069c95677774be2dff3", "type": "github" }, "original": { - "owner": "phadej", - "repo": "HTTP", - "type": "github" - } - }, - "cabal-32": { - "flake": false, - "locked": { - "lastModified": 1603716527, - "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", - "owner": "haskell", - "repo": "cabal", - "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.2", - "repo": "cabal", - "type": "github" - } - }, - "cabal-34": { - "flake": false, - "locked": { - "lastModified": 1645834128, - "narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=", - "owner": "haskell", - "repo": "cabal", - "rev": "5ff598c67f53f7c4f48e31d722ba37172230c462", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.4", - "repo": "cabal", - "type": "github" - } - }, - "cabal-36": { - "flake": false, - "locked": { - "lastModified": 1669081697, - "narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=", - "owner": "haskell", - "repo": "cabal", - "rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.6", - "repo": "cabal", - "type": "github" - } - }, - "cardano-shell": { - "flake": false, - "locked": { - "lastModified": 1608537748, - "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", - "owner": "input-output-hk", - "repo": "cardano-shell", - "rev": "9392c75087cb9a3d453998f4230930dea3a95725", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "cardano-shell", + "owner": "kadena-io", + "repo": "empty", "type": "github" } }, @@ -105,11 +38,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1687709756, - "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -118,47 +51,51 @@ "type": "github" } }, - "flake-utils_2": { + "ghc980": { + "flake": false, "locked": { - "lastModified": 1679360468, - "narHash": "sha256-LGnza3cfXF10Biw3ZTg0u9o9t7s680Ww200t5KkHTh8=", - "owner": "hamishmack", - "repo": "flake-utils", - "rev": "e1ea268ff47ad475443dbabcd54744b4e5b9d4f5", - "type": "github" + "lastModified": 1692910316, + "narHash": "sha256-Qv8I3GzzIIN32RTEKI38BW5nO1f7j6Xm+dDeDUyYZWo=", + "ref": "ghc-9.8", + "rev": "249aa8193e4c5c1ee46ce29b39d2fffa57de7904", + "revCount": 61566, + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" }, "original": { - "owner": "hamishmack", - "ref": "hkm/nested-hydraJobs", - "repo": "flake-utils", - "type": "github" + "ref": "ghc-9.8", + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" } }, - "ghc-8.6.5-iohk": { + "ghc99": { "flake": false, "locked": { - "lastModified": 1600920045, - "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", - "owner": "input-output-hk", - "repo": "ghc", - "rev": "95713a6ecce4551240da7c96b6176f980af75cae", - "type": "github" + "lastModified": 1695427505, + "narHash": "sha256-j0hXl6uEI+Uwf37z3WLuQZN4S0XqGtiepELv2Gl2aHU=", + "ref": "refs/heads/master", + "rev": "b8e4fe2318798185228fb5f8214ba2384ac95b4f", + "revCount": 61951, + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" }, "original": { - "owner": "input-output-hk", - "ref": "release/8.6.5-iohk", - "repo": "ghc", - "type": "github" + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" } }, "hackage": { "flake": false, "locked": { - "lastModified": 1688430724, - "narHash": "sha256-1+7TdZdr0v5PEttAbhBdMnfQWTTr42tDsKsFuE2pIpg=", + "lastModified": 1696379114, + "narHash": "sha256-dtax/ci3JfYvR2lLsvpvC6b3NCoEGZLrDH21/2svTps=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "f23ead9c62542c2abdd68970ada00b4ce1cce941", + "rev": "21eae6f46c91831741496101e541e628aadecd98", "type": "github" }, "original": { @@ -169,40 +106,107 @@ }, "haskellNix": { "inputs": { - "HTTP": "HTTP", - "cabal-32": "cabal-32", - "cabal-34": "cabal-34", - "cabal-36": "cabal-36", - "cardano-shell": "cardano-shell", + "HTTP": [ + "hs-nix-infra", + "empty" + ], + "cabal-32": [ + "hs-nix-infra", + "empty" + ], + "cabal-34": [ + "hs-nix-infra", + "empty" + ], + "cabal-36": [ + "hs-nix-infra", + "empty" + ], + "cardano-shell": [ + "hs-nix-infra", + "empty" + ], "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", - "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", - "hackage": "hackage", - "hls-1.10": "hls-1.10", - "hls-2.0": "hls-2.0", - "hpc-coveralls": "hpc-coveralls", - "hydra": "hydra", - "iserv-proxy": "iserv-proxy", + "ghc-8.6.5-iohk": [ + "hs-nix-infra", + "empty" + ], + "ghc980": "ghc980", + "ghc99": "ghc99", + "hackage": [ + "hs-nix-infra", + "hackage" + ], + "hls-1.10": [ + "hs-nix-infra", + "empty" + ], + "hls-2.0": [ + "hs-nix-infra", + "empty" + ], + "hls-2.2": [ + "hs-nix-infra", + "empty" + ], + "hls-2.3": "hls-2.3", + "hpc-coveralls": [ + "hs-nix-infra", + "empty" + ], + "hydra": [ + "hs-nix-infra", + "empty" + ], + "iserv-proxy": [ + "hs-nix-infra", + "empty" + ], "nixpkgs": [ + "hs-nix-infra", "haskellNix", "nixpkgs-unstable" ], - "nixpkgs-2003": "nixpkgs-2003", - "nixpkgs-2105": "nixpkgs-2105", - "nixpkgs-2111": "nixpkgs-2111", - "nixpkgs-2205": "nixpkgs-2205", - "nixpkgs-2211": "nixpkgs-2211", - "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-2003": [ + "hs-nix-infra", + "empty" + ], + "nixpkgs-2105": [ + "hs-nix-infra", + "empty" + ], + "nixpkgs-2111": [ + "hs-nix-infra", + "empty" + ], + "nixpkgs-2205": [ + "hs-nix-infra", + "empty" + ], + "nixpkgs-2211": [ + "hs-nix-infra", + "empty" + ], + "nixpkgs-2305": [ + "hs-nix-infra", + "empty" + ], "nixpkgs-unstable": "nixpkgs-unstable", - "old-ghc-nix": "old-ghc-nix", - "stackage": "stackage" + "old-ghc-nix": [ + "hs-nix-infra", + "empty" + ], + "stackage": [ + "hs-nix-infra", + "empty" + ] }, "locked": { - "lastModified": 1688431991, - "narHash": "sha256-lOfLzFvZfXkJuKOBxuf7KBxHyO4w1dDBLc+Kc0ITN5c=", + "lastModified": 1697195891, + "narHash": "sha256-0L803S/wcHmVebEwFxObYCYOaB14ZtBAFCdg0aRgH70=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "eb98796446a42551bc685065b296dba8f9241ca7", + "rev": "c6cb3ff56b001b211690da35f70827fab5bf3272", "type": "github" }, "original": { @@ -211,268 +215,67 @@ "type": "github" } }, - "hls-1.10": { + "hls-2.3": { "flake": false, "locked": { - "lastModified": 1680000865, - "narHash": "sha256-rc7iiUAcrHxwRM/s0ErEsSPxOR3u8t7DvFeWlMycWgo=", + "lastModified": 1695910642, + "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", "owner": "haskell", "repo": "haskell-language-server", - "rev": "b08691db779f7a35ff322b71e72a12f6e3376fd9", + "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", "type": "github" }, "original": { "owner": "haskell", - "ref": "1.10.0.0", + "ref": "2.3.0.0", "repo": "haskell-language-server", "type": "github" } }, - "hls-2.0": { - "flake": false, - "locked": { - "lastModified": 1684398654, - "narHash": "sha256-RW44up2BIyBBYN6tZur5f9kDDR3kr0Rd+TgPbLTfwB4=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "20c6d1e731cd9c0beef7338e2fc7a8126ba9b6fb", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.0.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hpc-coveralls": { - "flake": false, - "locked": { - "lastModified": 1607498076, - "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", - "type": "github" - }, - "original": { - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "type": "github" - } - }, - "hydra": { + "hs-nix-infra": { "inputs": { - "nix": "nix", - "nixpkgs": [ - "haskellNix", - "hydra", - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1671755331, - "narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=", - "owner": "NixOS", - "repo": "hydra", - "rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8", - "type": "github" - }, - "original": { - "id": "hydra", - "type": "indirect" - } - }, - "iserv-proxy": { - "flake": false, - "locked": { - "lastModified": 1670983692, - "narHash": "sha256-avLo34JnI9HNyOuauK5R69usJm+GfW3MlyGlYxZhTgY=", - "ref": "hkm/remote-iserv", - "rev": "50d0abb3317ac439a4e7495b185a64af9b7b9300", - "revCount": 10, - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" - }, - "original": { - "ref": "hkm/remote-iserv", - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" - } - }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs", - "nixpkgs-regression": "nixpkgs-regression" + "empty": "empty", + "hackage": "hackage", + "haskellNix": "haskellNix", + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1661606874, - "narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=", - "owner": "NixOS", - "repo": "nix", - "rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f", + "lastModified": 1699020807, + "narHash": "sha256-T/vXF8PXGGnZXNAspFx3yhGFWh4n3a8f1UHlfuHWH1A=", + "owner": "kadena-io", + "repo": "hs-nix-infra", + "rev": "4e2cc022e56412eef42527f3876bae8c0ad0fe5d", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "2.11.0", - "repo": "nix", + "owner": "kadena-io", + "repo": "hs-nix-infra", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1657693803, - "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2003": { - "locked": { - "lastModified": 1620055814, - "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-20.03-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2105": { - "locked": { - "lastModified": 1659914493, - "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2111": { - "locked": { - "lastModified": 1659446231, - "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2205": { - "locked": { - "lastModified": 1682600000, - "narHash": "sha256-ha4BehR1dh8EnXSoE1m/wyyYVvHI9txjW4w5/oxsW5Y=", + "lastModified": 1669833724, + "narHash": "sha256-/HEZNyGbnQecrgJnfE8d0WC5c1xuPSD2LUpB6YXlg4c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "50fc86b75d2744e1ab3837ef74b53f103a9b55a0", + "rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-22.05-darwin", "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2211": { - "locked": { - "lastModified": 1685314633, - "narHash": "sha256-8LXBPqTQXl5ofkjpJ18JcbmLJ/lWDoMxtUwiDYv0wro=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c8a17ce7abc03c50cd072e9e6c9b389c5f61836b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-22.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2305": { - "locked": { - "lastModified": 1685338297, - "narHash": "sha256-+Aq4O0Jn1W1q927ZHc3Zn6RO7bwQGmb6O8xYoGy0KrM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6287b47dbfabbb8bfbb9b1b53d198ad58a774de4", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-23.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1685347552, - "narHash": "sha256-9woSppRyUFo26yUffORTzttJ+apOt8MmCv6RxpPNTU4=", + "lastModified": 1695318763, + "narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f2f1ec390714d303cf84ba086e34e45b450dd8c4", + "rev": "e12483116b3b51a185a33a272bf351e357ba9a99", "type": "github" }, "original": { @@ -482,47 +285,10 @@ "type": "github" } }, - "old-ghc-nix": { - "flake": false, - "locked": { - "lastModified": 1631092763, - "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", - "owner": "angerman", - "repo": "old-ghc-nix", - "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", - "type": "github" - }, - "original": { - "owner": "angerman", - "ref": "master", - "repo": "old-ghc-nix", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", - "haskellNix": "haskellNix", - "nixpkgs": [ - "haskellNix", - "nixpkgs-unstable" - ] - } - }, - "stackage": { - "flake": false, - "locked": { - "lastModified": 1688429457, - "narHash": "sha256-N1syApmIUkEKe/L4JjOWdNwE52MO3T/pugps0m0Oj7o=", - "owner": "input-output-hk", - "repo": "stackage.nix", - "rev": "437335c8c10933e4d9fc049bfcdfe99a74d3d23a", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "stackage.nix", - "type": "github" + "hs-nix-infra": "hs-nix-infra" } }, "systems": { diff --git a/flake.nix b/flake.nix index 55ea255..7f5aa32 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,13 @@ { description = "Chainweb Mining Client"; - inputs.haskellNix.url = "github:input-output-hk/haskell.nix"; - inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, flake-utils, haskellNix }: + inputs = { + hs-nix-infra.url = "github:kadena-io/hs-nix-infra"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = { self, hs-nix-infra, flake-utils, }: flake-utils.lib.eachDefaultSystem (system: let + inherit (hs-nix-infra) nixpkgs haskellNix; overlays = [ haskellNix.overlay (final: prev: { # This overlay adds our project to pkgs From c5a56acb211dec820998cb6c8403f76c7cdcfee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Mon, 6 Nov 2023 16:11:39 +0100 Subject: [PATCH 07/14] Add Nix build and cache action --- .github/workflows/nix.yml | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/nix.yml diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000..f875b96 --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,42 @@ +name: Build and cache with Nix + +on: + workflow_dispatch: + push: + paths: + - '**' + - '!.github/**' + - '.github/workflows/nix.yml' + +jobs: + build-and-cache: + runs-on: ${{ matrix.os }} + timeout-minutes: 740 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, macos-m1] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Nix with caching + uses: kadena-io/setup-nix-with-cache/by-root@v3 + with: + cache_url: s3://nixcache.chainweb.com?region=us-east-1 + signing_private_key: ${{ secrets.NIX_CACHE_PRIVATE_KEY }} + + - name: Set up AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.NIX_CACHE_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.NIX_CACHE_AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Give root user AWS credentials + uses: kadena-io/setup-nix-with-cache/copy-root-aws-credentials@v3 + + - name: Build and cache artifacts + run: | + echo Building the project and its devShell + nix build --log-lines 500 --show-trace From 802e3adf8de21ee64607665cccf4b1e8bf5c2175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 14 Nov 2023 11:38:10 +0100 Subject: [PATCH 08/14] Add a recursive output --- flake.lock | 91 ++++++++++++++++++++++++++++-------------------------- flake.nix | 15 +++++++-- 2 files changed, 59 insertions(+), 47 deletions(-) diff --git a/flake.lock b/flake.lock index f0b4d7b..6a72030 100644 --- a/flake.lock +++ b/flake.lock @@ -17,6 +17,21 @@ } }, "flake-compat": { + "locked": { + "lastModified": 1699384378, + "narHash": "sha256-jI0nYllONVrNnyOYrvQMIEJQJuNeKnfJo5keRxWMcWs=", + "owner": "kadena-io", + "repo": "flake-compat", + "rev": "6ef9397736efb0f6075188aa3488022d1b85c11d", + "type": "github" + }, + "original": { + "owner": "kadena-io", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1672831974, @@ -51,43 +66,6 @@ "type": "github" } }, - "ghc980": { - "flake": false, - "locked": { - "lastModified": 1692910316, - "narHash": "sha256-Qv8I3GzzIIN32RTEKI38BW5nO1f7j6Xm+dDeDUyYZWo=", - "ref": "ghc-9.8", - "rev": "249aa8193e4c5c1ee46ce29b39d2fffa57de7904", - "revCount": 61566, - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - }, - "original": { - "ref": "ghc-9.8", - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - } - }, - "ghc99": { - "flake": false, - "locked": { - "lastModified": 1695427505, - "narHash": "sha256-j0hXl6uEI+Uwf37z3WLuQZN4S0XqGtiepELv2Gl2aHU=", - "ref": "refs/heads/master", - "rev": "b8e4fe2318798185228fb5f8214ba2384ac95b4f", - "revCount": 61951, - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - }, - "original": { - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - } - }, "hackage": { "flake": false, "locked": { @@ -126,13 +104,19 @@ "hs-nix-infra", "empty" ], - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "ghc-8.6.5-iohk": [ "hs-nix-infra", "empty" ], - "ghc980": "ghc980", - "ghc99": "ghc99", + "ghc980": [ + "hs-nix-infra", + "empty" + ], + "ghc99": [ + "hs-nix-infra", + "empty" + ], "hackage": [ "hs-nix-infra", "hackage" @@ -235,20 +219,23 @@ "hs-nix-infra": { "inputs": { "empty": "empty", + "flake-compat": "flake-compat", "hackage": "hackage", "haskellNix": "haskellNix", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-rec": "nixpkgs-rec" }, "locked": { - "lastModified": 1699020807, - "narHash": "sha256-T/vXF8PXGGnZXNAspFx3yhGFWh4n3a8f1UHlfuHWH1A=", + "lastModified": 1699956738, + "narHash": "sha256-OurMcrf07sCDHBumWm8lorsA9hhiKX5KnVogsxx7bJs=", "owner": "kadena-io", "repo": "hs-nix-infra", - "rev": "4e2cc022e56412eef42527f3876bae8c0ad0fe5d", + "rev": "8c1053765b265a8f13885687f00e094a7a5b76e5", "type": "github" }, "original": { "owner": "kadena-io", + "ref": "enis/metadata-experiments", "repo": "hs-nix-infra", "type": "github" } @@ -269,6 +256,22 @@ "type": "github" } }, + "nixpkgs-rec": { + "locked": { + "lastModified": 1669833724, + "narHash": "sha256-/HEZNyGbnQecrgJnfE8d0WC5c1xuPSD2LUpB6YXlg4c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1695318763, diff --git a/flake.nix b/flake.nix index 7f5aa32..d769aef 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "Chainweb Mining Client"; inputs = { - hs-nix-infra.url = "github:kadena-io/hs-nix-infra"; + hs-nix-infra.url = "github:kadena-io/hs-nix-infra/enis/metadata-experiments"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, hs-nix-infra, flake-utils, }: @@ -32,9 +32,18 @@ }) ]; pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; - flake = pkgs.chainweb-mining-client.flake {}; - in flake // { + project = pkgs.chainweb-mining-client; + flake = project.flake {}; + in { # Built by `nix build .` packages.default = flake.packages."chainweb-mining-client:exe:chainweb-mining-client"; + packages.recursive = with hs-nix-infra.lib.recursive system; + wrapRecursiveWithMeta "chainweb-mining-client" "${wrapFlake self}.default"; + + devShell = flake.devShell; + + # Other flake outputs provided by haskellNix can be accessed through + # this project output + inherit project; }); } From 2e8135f66926bf04e0dfa4d3abb3485ce5639e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 14 Nov 2023 11:38:50 +0100 Subject: [PATCH 09/14] Build recursive.allDerivations in CI --- .github/workflows/nix.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index f875b96..29a40cc 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -40,3 +40,6 @@ jobs: run: | echo Building the project and its devShell nix build --log-lines 500 --show-trace + + echo Build the recursive output + nix build .#recursive.allDerivations --accept-flake-config --log-lines 500 --show-trace From 7465e9db9d30ed00ac3dd44457470294d823e32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 14 Nov 2023 11:47:35 +0100 Subject: [PATCH 10/14] Update setup-nix-with-cache --- .github/workflows/nix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 29a40cc..866277f 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Nix with caching - uses: kadena-io/setup-nix-with-cache/by-root@v3 + uses: kadena-io/setup-nix-with-cache/by-root@v3.1 with: cache_url: s3://nixcache.chainweb.com?region=us-east-1 signing_private_key: ${{ secrets.NIX_CACHE_PRIVATE_KEY }} @@ -34,7 +34,7 @@ jobs: aws-region: us-east-1 - name: Give root user AWS credentials - uses: kadena-io/setup-nix-with-cache/copy-root-aws-credentials@v3 + uses: kadena-io/setup-nix-with-cache/copy-root-aws-credentials@v3.1 - name: Build and cache artifacts run: | From 4f8f4e21f2ba7b530146c8bc53335e35ecf293aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 14 Nov 2023 11:51:12 +0100 Subject: [PATCH 11/14] Configure Nix with recursive-nix --- .github/workflows/nix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 866277f..029fb84 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -25,6 +25,7 @@ jobs: with: cache_url: s3://nixcache.chainweb.com?region=us-east-1 signing_private_key: ${{ secrets.NIX_CACHE_PRIVATE_KEY }} + additional_experimental_features: recursive-nix - name: Set up AWS credentials uses: aws-actions/configure-aws-credentials@v2 From 598d0408e3b5b1ea85a2a21e478b7befa0f1d54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 14 Nov 2023 12:04:33 +0100 Subject: [PATCH 12/14] Switch back to hs-nix-infra/main --- flake.lock | 5 ++--- flake.nix | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 6a72030..fa4cb1a 100644 --- a/flake.lock +++ b/flake.lock @@ -226,16 +226,15 @@ "nixpkgs-rec": "nixpkgs-rec" }, "locked": { - "lastModified": 1699956738, + "lastModified": 1699959816, "narHash": "sha256-OurMcrf07sCDHBumWm8lorsA9hhiKX5KnVogsxx7bJs=", "owner": "kadena-io", "repo": "hs-nix-infra", - "rev": "8c1053765b265a8f13885687f00e094a7a5b76e5", + "rev": "a38e0b9c37cc67ef27241d33fcc30d01125f12b5", "type": "github" }, "original": { "owner": "kadena-io", - "ref": "enis/metadata-experiments", "repo": "hs-nix-infra", "type": "github" } diff --git a/flake.nix b/flake.nix index d769aef..2204adc 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "Chainweb Mining Client"; inputs = { - hs-nix-infra.url = "github:kadena-io/hs-nix-infra/enis/metadata-experiments"; + hs-nix-infra.url = "github:kadena-io/hs-nix-infra"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, hs-nix-infra, flake-utils, }: From 2f3f37d9753166013bf45beddf124673ce1ba58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 14 Nov 2023 15:11:15 +0100 Subject: [PATCH 13/14] Bump hs-nix-infra --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index fa4cb1a..4b7fd5e 100644 --- a/flake.lock +++ b/flake.lock @@ -226,11 +226,11 @@ "nixpkgs-rec": "nixpkgs-rec" }, "locked": { - "lastModified": 1699959816, - "narHash": "sha256-OurMcrf07sCDHBumWm8lorsA9hhiKX5KnVogsxx7bJs=", + "lastModified": 1699970998, + "narHash": "sha256-NgvBCRIB+lvcxJWMpU8Mulx8PG8s5jtqSR8K/natoTA=", "owner": "kadena-io", "repo": "hs-nix-infra", - "rev": "a38e0b9c37cc67ef27241d33fcc30d01125f12b5", + "rev": "a69071dafa3f0d12edf30ecc5a562aee1f7d138d", "type": "github" }, "original": { From c8e96160fd1fb26ec5cdeab0b53be036786a9aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Thu, 16 Nov 2023 13:05:41 +0100 Subject: [PATCH 14/14] Turn default.nix into a function In order to maintain backwards compatibility with old consumers --- default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/default.nix b/default.nix index f8164ed..e1ba434 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,6 @@ +{ + ... # Maintain backwards compatibility with old consumers +}: (import ( fetchTarball { url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz";