From 6037b13069c1a285f5b3bfd30440655a1ccd9b04 Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Thu, 10 Aug 2023 17:42:19 +0200 Subject: [PATCH] nix.flake: simplify nix setup Based on `cardano-cli` `nix.flake`. --- default.nix | 59 --- flake.lock | 715 +++++++++++++++++++++++------ flake.nix | 164 ++++++- nix/cells/automation/hydraJobs.nix | 6 - nix/cells/cloud/actions.nix | 29 -- nix/cells/cloud/library.nix | 1 - nix/check-nixfmt.nix | 14 - nix/default.nix | 61 --- nix/local-config.nix | 5 - nix/network-docs.nix | 2 +- nix/ouroboros-network.nix | 102 ---- nix/pkgs.nix | 37 -- nix/regenerate.sh | 5 - nix/scriv.nix | 25 - nix/sources.json | 53 --- nix/sources.nix | 169 ------- nix/stack-shell.nix | 14 - nix/util.nix | 9 - nix/windows-testing-bundle.nix | 37 -- release.nix | 161 ------- 20 files changed, 721 insertions(+), 947 deletions(-) delete mode 100644 default.nix delete mode 100644 nix/cells/automation/hydraJobs.nix delete mode 100644 nix/cells/cloud/actions.nix delete mode 100644 nix/cells/cloud/library.nix delete mode 100644 nix/check-nixfmt.nix delete mode 100644 nix/default.nix delete mode 100644 nix/local-config.nix delete mode 100644 nix/ouroboros-network.nix delete mode 100644 nix/pkgs.nix delete mode 100755 nix/regenerate.sh delete mode 100644 nix/scriv.nix delete mode 100644 nix/sources.json delete mode 100644 nix/sources.nix delete mode 100644 nix/stack-shell.nix delete mode 100644 nix/util.nix delete mode 100644 nix/windows-testing-bundle.nix delete mode 100644 release.nix diff --git a/default.nix b/default.nix deleted file mode 100644 index 7e910db6842..00000000000 --- a/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ system ? builtins.currentSystem, crossSystem ? null - # allows to cutomize haskellNix (profiling, see ./nix/ouroboros-network.nix) -, config ? { } - # allows to override dependencies of the project without modifications, - # eg. to test build against local checkout of nixpkgs and iohk-nix: - # nix build -f default.nix cardano-ledger-byron --arg sourcesOverride '{ - # iohk-nix = ../iohk-nix; - # }' -, sourcesOverride ? { } - # pinned version of nixpkgs augmented with overlays (iohk-nix and our packages). -, pkgs ? import ./nix { inherit system crossSystem config sourcesOverride; } -, gitrev ? pkgs.iohkNix.commitIdFromGitRepoOrZero ./.git }: -with pkgs; -with commonLib; -let - haskellPackages = recRecurseIntoAttrs - # the Haskell.nix package set, reduced to local packages. - (selectProjectPackages ouroborosNetworkHaskellPackages); - - coveredProject = - ouroborosNetworkHaskellPackages.appendModule { coverage = true; }; - - haskellPackagesWithTVarCheck = recRecurseIntoAttrs - (selectProjectPackages ouroborosNetworkHaskellPackagesWithTVarCheck); - - self = { - inherit haskellPackages network-docs coveredProject; - - inherit (haskellPackages.ouroboros-network.identifier) version; - - # `tests` are the test suites which have been built. - tests = collectComponents' "tests" haskellPackages; - # `benchmarks` (only built, not run). - benchmarks = collectComponents' "benchmarks" haskellPackages; - - libs = collectComponents' "library" haskellPackages; - - exes = collectComponents' "exes" haskellPackages; - - checks = recurseIntoAttrs { - # `checks.tests` collect results of executing the tests: - tests = collectChecks' haskellPackages; - styles = recurseIntoAttrs { - check-nixfmt = callPackage ./nix/check-nixfmt.nix { }; - check-stylish = callPackage ./nix/check-stylish.nix { }; - }; - }; - - nightly-checks.tvar-invariant-checks = recurseIntoAttrs { - inherit haskellPackagesWithTVarCheck; - tests = collectChecks' haskellPackagesWithTVarCheck; - }; - - shell = import ./shell.nix { - inherit pkgs; - withHoogle = true; - }; - }; -in self diff --git a/flake.lock b/flake.lock index a6a87c947e2..835cdadae45 100644 --- a/flake.lock +++ b/flake.lock @@ -1,92 +1,328 @@ { "nodes": { - "blank": { + "CHaP": { + "flake": false, "locked": { - "lastModified": 1625557891, - "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", - "owner": "divnix", - "repo": "blank", - "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "lastModified": 1691592884, + "narHash": "sha256-8wxAVk2SKZE0E/4LiKzmsBtwnONUqZKFbmMUVC56eas=", + "owner": "input-output-hk", + "repo": "cardano-haskell-packages", + "rev": "c867f3ff8872a8026baff83c1a3127287671ddc3", "type": "github" }, "original": { - "owner": "divnix", - "repo": "blank", + "owner": "input-output-hk", + "ref": "repo", + "repo": "cardano-haskell-packages", "type": "github" } }, - "devshell": { - "inputs": { - "flake-utils": [ - "std", - "flake-utils" - ], - "nixpkgs": [ - "std", - "nixpkgs" - ] + "HTTP": { + "flake": false, + "locked": { + "lastModified": 1451647621, + "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", + "owner": "phadej", + "repo": "HTTP", + "rev": "9bc0996d412fef1787449d841277ef663ad9a915", + "type": "github" }, + "original": { + "owner": "phadej", + "repo": "HTTP", + "type": "github" + } + }, + "blst": { + "flake": false, "locked": { - "lastModified": 1663445644, - "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", - "owner": "numtide", - "repo": "devshell", - "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "lastModified": 1656163412, + "narHash": "sha256-xero1aTe2v4IhWIJaEDUsVDOfE77dOV5zKeHWntHogY=", + "owner": "supranational", + "repo": "blst", + "rev": "03b5124029979755c752eec45f3c29674b558446", "type": "github" }, "original": { - "owner": "numtide", - "repo": "devshell", + "owner": "supranational", + "repo": "blst", + "rev": "03b5124029979755c752eec45f3c29674b558446", "type": "github" } }, - "dmerge": { - "inputs": { - "nixlib": [ - "std", - "nixpkgs" - ], - "yants": [ - "std", - "yants" - ] + "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": 1659548052, - "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=", - "owner": "divnix", - "repo": "data-merge", - "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497", + "lastModified": 1645834128, + "narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=", + "owner": "haskell", + "repo": "cabal", + "rev": "5ff598c67f53f7c4f48e31d722ba37172230c462", "type": "github" }, "original": { - "owner": "divnix", - "repo": "data-merge", + "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": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", + "lastModified": 1681378341, + "narHash": "sha256-2qUN04W6X9cHHytEsJTM41CmusifPTC0bgTtYsHSNY8=", + "owner": "hamishmack", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "2767bafdb189cd623354620c2dacbeca8fd58b17", "type": "github" }, "original": { - "owner": "numtide", + "owner": "hamishmack", + "ref": "hkm/nested-hydraJobs", "repo": "flake-utils", "type": "github" } }, - "incl": { + "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": 1691627137, + "narHash": "sha256-PcNZKon4f8e5QGcK3frc7NL4A7VT/XYwV7pLX9cqfPE=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "c80aff637d5864de25f2c38a813544cb624deed2", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskellNix": { "inputs": { - "nixlib": [ - "std", + "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": 1691628381, + "narHash": "sha256-JWZNUx2yoh6HdIGK/RGmpqEbef+6Pa2fXmECbtx/7OA=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "2113481d380c75fdeb7125ca518829c964d7b1a5", + "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": 1687698105, + "narHash": "sha256-OHXlgRzs/kuJH8q7Sxh507H+0Rb8b7VOiPAjcY9sM1k=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "783905f211ac63edf982dd1889c671653327e441", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.0.0.1", + "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" + } + }, + "incl": { + "inputs": { + "nixlib": "nixlib" + }, "locked": { "lastModified": 1669263024, "narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=", @@ -101,157 +337,348 @@ "type": "github" } }, - "n2c": { + "iohkNix": { "inputs": { - "flake-utils": [ - "std", - "flake-utils" - ], - "nixpkgs": [ - "std", - "nixpkgs" - ] + "blst": "blst", + "nixpkgs": "nixpkgs_2", + "secp256k1": "secp256k1", + "sodium": "sodium" + }, + "locked": { + "lastModified": 1691469905, + "narHash": "sha256-TV0p1dFGYAMl1dLJEfe/tNFjxvV2H7VgHU1I43q+b84=", + "owner": "input-output-hk", + "repo": "iohk-nix", + "rev": "2f3760f135616ebc477d3ed74eba9b63c22f83a0", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "iohk-nix", + "type": "github" + } + }, + "iserv-proxy": { + "flake": false, + "locked": { + "lastModified": 1688517130, + "narHash": "sha256-hUqfxSlo+ffqVdkSZ1EDoB7/ILCL25eYkcCXW9/P3Wc=", + "ref": "hkm/remote-iserv", + "rev": "9151db2a9a61d7f5fe52ff8836f18bbd0fd8933c", + "revCount": 13, + "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": 1665039323, - "narHash": "sha256-SAh3ZjFGsaCI8FRzXQyp56qcGdAqgKEfJWPCQ0Sr7tQ=", - "owner": "nlewo", - "repo": "nix2container", - "rev": "b008fe329ffb59b67bf9e7b08ede6ee792f2741a", + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", "type": "github" }, "original": { - "owner": "nlewo", - "repo": "nix2container", + "owner": "kristapsdz", + "repo": "lowdown", "type": "github" } }, - "nixago": { + "nix": { "inputs": { - "flake-utils": [ - "std", - "flake-utils" - ], - "nixago-exts": [ - "std", - "blank" - ], - "nixpkgs": [ - "std", - "nixpkgs" - ] + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs", + "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1661824785, - "narHash": "sha256-/PnwdWoO/JugJZHtDUioQp3uRiWeXHUdgvoyNbXesz8=", + "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" + } + }, + "nixlib": { + "locked": { + "lastModified": 1667696192, + "narHash": "sha256-hOdbIhnpWvtmVynKcsj10nxz9WROjZja+1wRAJ/C9+s=", "owner": "nix-community", - "repo": "nixago", - "rev": "8c1f9e5f1578d4b2ea989f618588d62a335083c3", + "repo": "nixpkgs.lib", + "rev": "babd9cd2ca6e413372ed59fbb1ecc3c3a5fd3e5b", "type": "github" }, "original": { "owner": "nix-community", - "repo": "nixago", + "repo": "nixpkgs.lib", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1665087388, - "narHash": "sha256-FZFPuW9NWHJteATOf79rZfwfRn5fE0wi9kRzvGfDHPA=", + "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": 1685573264, + "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "380be19fbd2d9079f677978361792cb25e8a3635", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2211": { + "locked": { + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2305": { + "locked": { + "lastModified": 1690680713, + "narHash": "sha256-NXCWA8N+GfSQyoN7ZNiOgq/nDJKOp5/BHEpiZP8sUZw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b81af66deb21f73a70c67e5ea189568af53b1e8c", + "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": 1690720142, + "narHash": "sha256-GywuiZjBKfFkntQwpNQfL+Ksa2iGjPprBGL0/psgRZM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3acb5c4264c490e7714d503c7166a3fde0c51324", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1684171562, + "narHash": "sha256-BMUWjVWAUdyMWKk0ATMC9H0Bv4qAV/TXwwPUvTiC5IQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "95fda953f6db2e9496d2682c4fc7b82f959878f7", + "rev": "55af203d468a6f5032a519cba4f41acf5a74b638", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixpkgs-unstable", + "ref": "release-22.11", "repo": "nixpkgs", "type": "github" } }, - "nosys": { + "old-ghc-nix": { + "flake": false, "locked": { - "lastModified": 1667881534, - "narHash": "sha256-FhwJ15uPLRsvaxtt/bNuqE/ykMpNAPF0upozFKhTtXM=", - "owner": "divnix", - "repo": "nosys", - "rev": "2d0d5207f6a230e9d0f660903f8db9807b54814f", + "lastModified": 1631092763, + "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", + "owner": "angerman", + "repo": "old-ghc-nix", + "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", "type": "github" }, "original": { - "owner": "divnix", - "repo": "nosys", + "owner": "angerman", + "ref": "master", + "repo": "old-ghc-nix", "type": "github" } }, "root": { "inputs": { + "CHaP": "CHaP", + "flake-utils": "flake-utils", + "haskellNix": "haskellNix", + "incl": "incl", + "iohkNix": "iohkNix", "nixpkgs": [ - "std", - "nixpkgs" - ], - "std": "std" + "haskellNix", + "nixpkgs-unstable" + ] } }, - "std": { - "inputs": { - "arion": [ - "std", - "blank" - ], - "blank": "blank", - "devshell": "devshell", - "dmerge": "dmerge", - "flake-utils": "flake-utils", - "incl": "incl", - "makes": [ - "std", - "blank" - ], - "microvm": [ - "std", - "blank" - ], - "n2c": "n2c", - "nixago": "nixago", - "nixpkgs": "nixpkgs", - "nosys": "nosys", - "yants": "yants" + "secp256k1": { + "flake": false, + "locked": { + "lastModified": 1683999695, + "narHash": "sha256-9nJJVENMXjXEJZzw8DHzin1DkFkF8h9m/c6PuM7Uk4s=", + "owner": "bitcoin-core", + "repo": "secp256k1", + "rev": "acf5c55ae6a94e5ca847e07def40427547876101", + "type": "github" }, + "original": { + "owner": "bitcoin-core", + "ref": "v0.3.2", + "repo": "secp256k1", + "type": "github" + } + }, + "sodium": { + "flake": false, "locked": { - "lastModified": 1673317235, - "narHash": "sha256-wrVmvBOaiDIQaYO+oVFCXnu8uLlNpeQSxpR+8JThFWY=", - "owner": "divnix", - "repo": "std", - "rev": "30b8998b2a15434ba70dd973895accf79bddd641", + "lastModified": 1675156279, + "narHash": "sha256-0uRcN5gvMwO7MCXVYnoqG/OmeBFi8qRVnDWJLnBb9+Y=", + "owner": "input-output-hk", + "repo": "libsodium", + "rev": "dbb48cce5429cb6585c9034f002568964f1ce567", "type": "github" }, "original": { - "owner": "divnix", - "repo": "std", + "owner": "input-output-hk", + "repo": "libsodium", + "rev": "dbb48cce5429cb6585c9034f002568964f1ce567", "type": "github" } }, - "yants": { - "inputs": { - "nixpkgs": [ - "std", - "nixpkgs" - ] + "stackage": { + "flake": false, + "locked": { + "lastModified": 1691366993, + "narHash": "sha256-H58GhNWd4YgJN/JYogAKIZOjuxtqTtjRwa4MAwHvT0U=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "28eadbd982b345fca498b098a1827c3418f67b9c", + "type": "github" }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + }, + "systems": { "locked": { - "lastModified": 1667096281, - "narHash": "sha256-wRRec6ze0gJHmGn6m57/zhz/Kdvp9HS4Nl5fkQ+uIuA=", - "owner": "divnix", - "repo": "yants", - "rev": "d18f356ec25cb94dc9c275870c3a7927a10f8c3c", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "owner": "divnix", - "repo": "yants", + "owner": "nix-systems", + "repo": "default", "type": "github" } } diff --git a/flake.nix b/flake.nix index c14859609f7..7b433dd3425 100644 --- a/flake.nix +++ b/flake.nix @@ -1,24 +1,158 @@ { + description = "ouroboros-network"; + inputs = { - nixpkgs.follows = "std/nixpkgs"; - std.url = "github:divnix/std"; + haskellNix.url = "github:input-output-hk/haskell.nix"; + nixpkgs.follows = "haskellNix/nixpkgs-unstable"; + iohkNix.url = "github:input-output-hk/iohk-nix"; + incl.url = "github:divnix/incl"; + flake-utils.url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs"; + + CHaP.url = "github:input-output-hk/cardano-haskell-packages?ref=repo"; + CHaP.flake = false; }; - outputs = { self, std, ... }@inputs: - std.growOn { - inherit inputs; - cellsFrom = nix/cells; - cellBlocks = [ - (std.functions "library") - (std.functions "hydraJobs") - (std.functions "actions") - ]; - } { hydraJobs = std.harvest self [ "automation" "hydraJobs" ]; }; + outputs = inputs: let + supportedSystems = [ + "x86_64-linux" + # disabling to reduce CI time initially. Uncomment later + #"x86_64-darwin" + #"aarch64-linux" + #"aarch64-darwin" + ]; + in + {inherit (inputs) incl;} + // inputs.flake-utils.lib.eachSystem supportedSystems ( + system: let + # setup our nixpkgs with the haskell.nix overlays, and the iohk-nix + # overlays... + nixpkgs = import inputs.nixpkgs { + overlays = [ + # iohkNix.overlays.crypto provide libsodium-vrf, libblst and libsecp256k1. + inputs.iohkNix.overlays.crypto + # haskellNix.overlay can be configured by later overlays, so need to come before them. + inputs.haskellNix.overlay + ]; + inherit system; + inherit (inputs.haskellNix) config; + }; + inherit (nixpkgs) lib; + + # see flake `variants` below for alternative compilers + defaultCompiler = "ghc927"; + # We use cabalProject' to ensure we don't build the plan for + # all systems. + cabalProject = nixpkgs.haskell-nix.cabalProject' ({config, ...}: { + src = ./.; + name = "ouroboros-network"; + compiler-nix-name = lib.mkDefault defaultCompiler; + + # we also want cross compilation to windows on linux (and only with default compiler). + crossPlatforms = p: + lib.optional (system == "x86_64-linux" && config.compiler-nix-name == defaultCompiler) + p.mingwW64; + + # CHaP input map, so we can find CHaP packages (needs to be more + # recent than the index-state we set!). Can be updated with + # + # nix flake lock --update-input CHaP + # + inputMap = { + "https://input-output-hk.github.io/cardano-haskell-packages" = inputs.CHaP; + }; + # tools we want in our shell, from hackage + shell.tools = + { + cabal = "3.10.1.0"; + ghcid = "0.8.8"; + } + // lib.optionalAttrs (config.compiler-nix-name == defaultCompiler) { + # tools that work only with default compiler + stylish-haskell = "0.14.4.0"; + haskell-language-server = "2.0.0.0"; + }; + # and from nixpkgs or other inputs + shell.nativeBuildInputs = with nixpkgs; [ gh jq yq-go ]; + # disable Hoogle until someone request it + shell.withHoogle = false; + # Skip cross compilers for the shell + shell.crossPlatforms = _: []; + + # package customizations as needed. Where cabal.project is not + # specific enough, or doesn't allow setting these. + modules = [ + ({pkgs, ...}: { + packages.ouroboros-network-api.configureFlags = ["--ghc-option=-Werror"]; + packages.ouroboros-network-protocols.configureFlags = ["--ghc-option=-Werror"]; + packages.ouroboros-network-protocols.components.tests.cddl.build-tools = [ nixpkgs.cddl ]; + packages.ouroboros-network-protocols.components.tests.cddl.preCheck = "export HOME=`pwd`"; + packages.ouroboros-network-framework.configureFlags = ["--ghc-option=-Werror"]; + packages.ouroboros-network-mock.configureFlags = ["--ghc-option=-Werror"]; + packages.ouroboros-network-testing.configureFlags = ["--ghc-option=-Werror"]; + packages.ouroboros-network.configureFlags = ["--ghc-option=-Werror"]; + packages.cardano-ping.configureFlags = ["--ghc-option=-Werror"]; + packages.cardano-client.configureFlags = ["--ghc-option=-Werror"]; + packages.ntp-client.configureFlags = ["--ghc-option=-Werror"]; + }) + ]; + }); + # ... and construct a flake from the cabal project + flake = cabalProject.flake ( + lib.optionalAttrs (system == "x86_64-linux") { + # on linux, build/test other supported compilers + variants = lib.genAttrs ["ghc8107"] (compiler-nix-name: { + inherit compiler-nix-name; + }); + } + ); + network-docs = nixpkgs.callPackage ./nix/network-docs.nix { }; + check-stylish = nixpkgs.callPackage ./nix/check-stylish.nix { }; + in + lib.recursiveUpdate flake rec { + project = cabalProject; + # add a required job, that's basically all hydraJobs. + hydraJobs = + nixpkgs.callPackages inputs.iohkNix.utils.ciJobsAggregates + { + ciJobs = + flake.hydraJobs + // { + # This ensure hydra send a status for the required job (even if no change other than commit hash) + revision = nixpkgs.writeText "revision" (inputs.self.rev or "dirty"); + inherit network-docs check-stylish; + }; + }; + legacyPackages = rec { + inherit cabalProject nixpkgs; + # also provide hydraJobs through legacyPackages to allow building without system prefix: + inherit hydraJobs; + inherit network-docs check-stylish; + }; + devShells = let + profillingShell = p: { + # `nix develop .#profiling` (or `.#ghc8107.profiling): a shell with profiling enabled + profiling = (p.appendModule {modules = [{enableLibraryProfiling = true;}];}).shell; + }; + in + profillingShell cabalProject + # Additional shells for every GHC version supported by haskell.nix, eg. `nix develop .#ghc927` + // lib.mapAttrs (compiler-nix-name: _: let + p = cabalProject.appendModule {inherit compiler-nix-name;}; + in + p.shell // (profillingShell p)) + nixpkgs.haskell-nix.compiler; + # formatter used by nix fmt + formatter = nixpkgs.alejandra; + } + ); nixConfig = { - extra-substituters = [ "https://cache.iog.io" ]; - extra-trusted-public-keys = - [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; + extra-substituters = [ + "https://cache.iog.io" + ]; + extra-trusted-public-keys = [ + "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" + ]; allow-import-from-derivation = true; }; } diff --git a/nix/cells/automation/hydraJobs.nix b/nix/cells/automation/hydraJobs.nix deleted file mode 100644 index a0d8db23580..00000000000 --- a/nix/cells/automation/hydraJobs.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ cell, inputs, }: - -import "${inputs.self}/release.nix" { - ouroboros-network = inputs.self; - supportedSystems = [ inputs.nixpkgs.system ]; -} diff --git a/nix/cells/cloud/actions.nix b/nix/cells/cloud/actions.nix deleted file mode 100644 index dbce0410559..00000000000 --- a/nix/cells/cloud/actions.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ cell, inputs, }: { - "ouroboros-network/ci" = { - task = "ci"; - io = '' - // This is a CUE expression that defines what events trigger a new run of this action. - // There is no documentation for this yet. Ask SRE if you have trouble changing this. - - let github = { - #input: "${cell.library.actionCiInputName}" - #repo: "input-output-hk/ouroboros-network" - } - - #lib.merge - #ios: [ - { - #lib.io.github_push - github - #default_branch: true - #branch: "gh-readonly-queue/.*" - }, - { - #lib.io.github_pr - github - inputs: (github.#input): match: github_body: pull_request: draft: false - }, - ] - ''; - }; -} diff --git a/nix/cells/cloud/library.nix b/nix/cells/cloud/library.nix deleted file mode 100644 index be0d6530611..00000000000 --- a/nix/cells/cloud/library.nix +++ /dev/null @@ -1 +0,0 @@ -{ inputs, cell, }: { actionCiInputName = "GitHub event"; } diff --git a/nix/check-nixfmt.nix b/nix/check-nixfmt.nix deleted file mode 100644 index c43c882fa09..00000000000 --- a/nix/check-nixfmt.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ runCommand, fd, nixfmt, haskell-nix }: - -runCommand "check-nixfmt" { - buildInputs = [ fd nixfmt ]; - src = haskell-nix.haskellLib.cleanGit { - name = "ouroboros-network-src"; - src = ../.; - }; -} '' - unpackPhase - cd $sourceRoot - fd -e nix -X nixfmt -c - echo $? >> $out -'' diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index 6b3d3e290ce..00000000000 --- a/nix/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ system ? builtins.currentSystem, crossSystem ? null, config ? { } -, sourcesOverride ? { } }: -let - sources = import ./sources.nix { pkgs = import nixpkgs { }; } - // sourcesOverride; - iohkNixMain = import sources.iohk-nix { }; - haskellNix = import sources."haskell.nix" { - inherit system; - sourcesOverride = { hackage = sources."hackage.nix"; } // sourcesOverride; - pkgs = import iohkNixMain.sources.nixpkgs { inherit system; }; - }; - haskellNixArgs = haskellNix.nixpkgsArgs; - nixpkgs = if (sources ? nixpkgs) then - (builtins.trace '' - Not using nixpkgs that haskell.nix is exposing. - * This means that you've added entry to 'sources.json' via niv. - * This is fine, but please be aware that you might be getting less cache hits. - * Use 'niv drop nixpkgs' to use haskell.nix's nixpkgs'' - sources.nixpkgs) - else - (builtins.trace "Using haskell.nix's nixpkgs. Good. Sharing is caring" - haskellNix.sources.nixpkgs-unstable); - # for inclusion in pkgs: - overlays = - # Haskell.nix (https://github.com/input-output-hk/haskell.nix) - haskellNixArgs.overlays - # haskell-nix.haskellLib.extra: some useful extra utility functions for haskell.nix - ++ iohkNixMain.overlays.haskell-nix-extra ++ iohkNixMain.overlays.crypto - # iohkNix: nix utilities and niv: - ++ iohkNixMain.overlays.iohkNix ++ iohkNixMain.overlays.utils - # our own overlays: - ++ [ - (pkgs: _: - with pkgs; { - - # commonLib: mix pkgs.lib with iohk-nix utils and our own: - commonLib = lib // iohkNix // import ./util.nix { - inherit haskell-nix; - } - # also expose our sources and overlays - // { - inherit overlays sources; - }; - }) - # And, of course, our haskell-nix-ified cabal project: - (import ./pkgs.nix { inherit sources; }) - ] ++ [ - # This overlay adds a field localConfig to the pkgs that will be used - # afterwards to retrieve the locally defined values for building the - # environment, like ghcVersion. - (self: super: { - localConfig = (super.localConfig or { }) // import ./local-config.nix; - }) - ]; - - pkgs = import nixpkgs { - inherit system crossSystem overlays; - config = haskellNixArgs.config // config; - }; - -in pkgs diff --git a/nix/local-config.nix b/nix/local-config.nix deleted file mode 100644 index 420be76c89a..00000000000 --- a/nix/local-config.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - ghcVersion = "ghc8107"; - # Index-state used by the tools on the shell - tools-index-state = "2023-04-25T00:00:00Z"; -} diff --git a/nix/network-docs.nix b/nix/network-docs.nix index 0a012c5eebb..6ab7e202bf5 100644 --- a/nix/network-docs.nix +++ b/nix/network-docs.nix @@ -2,7 +2,7 @@ with pkgs; let src = haskell-nix.haskellLib.cleanGit { - name = "ouroboros-network-protocols-docs-src"; + name = "ouroboros-network-docs-src"; src = ../.; subDir = "docs"; }; diff --git a/nix/ouroboros-network.nix b/nix/ouroboros-network.nix deleted file mode 100644 index 2079ebdfc1d..00000000000 --- a/nix/ouroboros-network.nix +++ /dev/null @@ -1,102 +0,0 @@ -# ########################################################################### -# Builds Haskell packages with Haskell.nix -############################################################################ -{ lib, stdenv, pkgs, haskell-nix, CHaP, buildPackages, config ? { } - # Enable profiling -, profiling ? config.haskellNix.profiling or false -, libsodium-vrf ? pkgs.libsodium-vrf, secp256k1 ? pkgs.secp256k1 - # Enable strict TVar invariant check flag in strict-stm -, checkTVarInvariants ? false }: -let - compiler-nix-name = pkgs.localConfig.ghcVersion; - src = haskell-nix.haskellLib.cleanGit { - name = "ouroboros-network-src"; - src = ../.; - }; - inputMap = { - "https://input-output-hk.github.io/cardano-haskell-packages" = CHaP; - }; - - projectPackages = lib.attrNames (haskell-nix.haskellLib.selectProjectPackages - (haskell-nix.cabalProject { inherit compiler-nix-name src inputMap; })); - - # This creates the Haskell package set. - # https://input-output-hk.github.io/haskell.nix/user-guide/projects/ - pkgSet = haskell-nix.cabalProject [ - ({ lib, pkgs, buildProject, ... }: { - options = { - coverage = lib.mkOption { - type = lib.types.bool; - description = - "Enable Haskell Program Coverage for ouroboros-network libraries and test suites."; - default = false; - }; - }; - }) - ({ config, ... }: { - inherit compiler-nix-name src inputMap; - modules = [ - - { - # Compile all local packages with -Werror: - packages = lib.genAttrs projectPackages - (name: { configureFlags = [ "--ghc-option=-Werror" ]; }); - } - { - packages = lib.genAttrs projectPackages (name: { - # Enable Haskell Program Coverage for all local libraries - # and test suites. - doCoverage = config.coverage; - }); - } - { - packages.strict-checked-vars.components.library.configureFlags = - lib.mkForce (if checkTVarInvariants then - [ "-f +checktvarinvariants" ] - else - [ ]); - } - ({ pkgs, ... }: { - # Apply profiling arg to all library components in the build: - enableLibraryProfiling = profiling; - }) - - # Options specific to the windows cross-compiled build: - ({ pkgs, ... }: - lib.mkIf pkgs.stdenv.hostPlatform.isWindows { - # ruby/perl dependencies cannot be cross-built for cddl tests: - packages.ouroboros-network-protocols.flags.cddl = false; - - # Make sure we use a buildPackages version of happy - packages.pretty-show.components.library.build-tools = - [ buildPackages.haskell-nix.haskellPackages.happy ]; - - # Remove hsc2hs build-tool dependencies (suitable version will be available as part of the ghc derivation) - packages.Win32.components.library.build-tools = lib.mkForce [ ]; - packages.terminal-size.components.library.build-tools = - lib.mkForce [ ]; - packages.network.components.library.build-tools = lib.mkForce [ ]; - }) - # Options for when not compiling to windows: - ({ pkgs, ... }: - lib.mkIf (!pkgs.stdenv.hostPlatform.isWindows) { - packages.ouroboros-network-protocols.flags.cddl = true; - packages.ouroboros-network-protocols.components.tests.cddl.build-tools = - [ pkgs.cddl pkgs.cbor-diag ]; - packages.ouroboros-network-protocols.components.tests.cddl.preCheck = - "export HOME=`pwd`"; - }) - # Fix for Plutus compilation with profiling - ({ pkgs, ... }: - lib.mkIf (!pkgs.stdenv.hostPlatform.isDarwin) { - # Needed for profiled builds to fix an issue loading recursion-schemes part of makeBaseFunctor - # that is missing from the `_p` output. See https://gitlab.haskell.org/ghc/ghc/-/issues/18320 - # This work around currently breaks regular builds on macOS with: - # : error: ghc: ghc-iserv terminated (-11) - packages.plutus-core.components.library.ghcOptions = - [ "-fexternal-interpreter" ]; - }) - ]; - }) - ]; -in pkgSet diff --git a/nix/pkgs.nix b/nix/pkgs.nix deleted file mode 100644 index 2b678f4fe94..00000000000 --- a/nix/pkgs.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ sources }: -# our packages overlay -pkgs: _: -with pkgs; -let - tool = name: version: other: - haskell-nix.tool localConfig.ghcVersion name ({ - version = version; - index-state = localConfig.tools-index-state; - } // other); -in { - ouroborosNetworkHaskellPackages = import ./ouroboros-network.nix { - inherit config pkgs lib stdenv haskell-nix buildPackages; - inherit (sources) CHaP; - }; - - ouroborosNetworkHaskellPackagesWithTVarCheck = - import ./ouroboros-network.nix { - inherit config pkgs lib stdenv haskell-nix buildPackages; - checkTVarInvariants = true; - inherit (sources) CHaP; - }; - - network-docs = callPackage ./network-docs.nix { }; - - cabal = tool "cabal" "latest" { }; - - stylish-haskell = tool "stylish-haskell" "0.14.4.0" { - cabalProjectLocal = "allow-older: ghc-lib-parser:base"; - }; - - cabal-fmt = tool "cabal-fmt" "latest" { }; - - scriv = pkgs.callPackage ./scriv.nix { }; - - trace = builtins.trace; -} diff --git a/nix/regenerate.sh b/nix/regenerate.sh deleted file mode 100755 index 4e2be286602..00000000000 --- a/nix/regenerate.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -cd $(git rev-parse --show-toplevel) - -exec $(nix-build `dirname $0`/. -A iohkNix.cabalProjectRegenerate --no-out-link --option substituters "https://hydra.iohk.io https://cache.nixos.org" --option trusted-substituters "" --option trusted-public-keys "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=")/bin/cabal-project-regenerate diff --git a/nix/scriv.nix b/nix/scriv.nix deleted file mode 100644 index 169937830ee..00000000000 --- a/nix/scriv.nix +++ /dev/null @@ -1,25 +0,0 @@ -# TODO remove once https://github.com/NixOS/nixpkgs/pull/212603 is in our nixpkgs pin - -{ lib, python3, fetchFromGitHub }: - -python3.pkgs.buildPythonApplication { - pname = "scriv"; - version = "1.2.0-custom-iog"; - - src = fetchFromGitHub { - owner = "input-output-hk"; - repo = "scriv"; - rev = "567a1aa3f6df77d1a531290f10a261ec6a49c75a"; - hash = "sha256-wpWDuZ3c8JJKVWPw9PHgcpneRWYjd/0z4oAIirPa0/E="; - }; - - propagatedBuildInputs = [ - python3.pkgs.attrs - python3.pkgs.click - python3.pkgs.click-log - python3.pkgs.jinja2 - python3.pkgs.requests - ] ++ lib.optionals (python3.pythonOlder "3.11") [ python3.pkgs.tomli ]; - - doCheck = false; -} diff --git a/nix/sources.json b/nix/sources.json deleted file mode 100644 index fe30571ed4e..00000000000 --- a/nix/sources.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "CHaP": { - "branch": "repo", - "description": "Metadata for Cardano's Haskell package repository", - "homepage": "https://input-output-hk.github.io/cardano-haskell-packages/", - "owner": "input-output-hk", - "repo": "cardano-haskell-packages", - "rev": "b0f4a91b7c6914b41da6d649facc66537550e932", - "sha256": "1h6jh05nr8xbvbqj8fh2amc2axmlzfivqbfz7wpw7cyjpcq225is", - "type": "tarball", - "url": "https://github.com/input-output-hk/cardano-haskell-packages/archive/b0f4a91b7c6914b41da6d649facc66537550e932.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "hackage.nix": { - "branch": "master", - "description": "Automatically generated Nix expressions for Hackage", - "homepage": "", - "owner": "input-output-hk", - "repo": "hackage.nix", - "rev": "4e6c3592ff197354762f3272515245ca862608ca", - "sha256": "1n3305hvl65yh2cizp5k6n620nk57nabdki3l67g4x1f2imjf5hb", - "type": "tarball", - "url": "https://github.com/input-output-hk/hackage.nix/archive/4e6c3592ff197354762f3272515245ca862608ca.tar.gz", - "url_template": "https://github.com///archive/.tar.gz", - "version": "b3c99d7f13df89a9a918c835ecb7114098912962" - }, - "haskell.nix": { - "branch": "master", - "description": "Alternative Haskell Infrastructure for Nixpkgs", - "homepage": "https://input-output-hk.github.io/haskell.nix", - "owner": "input-output-hk", - "repo": "haskell.nix", - "rev": "5f30c1ccf8eccc99660b745621df52c5923c231b", - "sha256": "1b3jli7jp1y87y3pb712krb678ncplp9jiz3b4nwv1xkcnw974hh", - "type": "tarball", - "url": "https://github.com/input-output-hk/haskell.nix/archive/5f30c1ccf8eccc99660b745621df52c5923c231b.tar.gz", - "url_template": "https://github.com///archive/.tar.gz", - "version": "962ecfed3a4fb656b5a91d89159291e00ed766bc" - }, - "iohk-nix": { - "branch": "master", - "description": "nix scripts shared across projects", - "homepage": null, - "owner": "input-output-hk", - "repo": "iohk-nix", - "rev": "c74d45b96acaa84bf441fb27d966ca830c0d98e3", - "sha256": "0wkda7ham7in8vhh36l4483aqvjlmp1yh87bjcsrpnxv29mc7wrg", - "type": "tarball", - "url": "https://github.com/input-output-hk/iohk-nix/archive/c74d45b96acaa84bf441fb27d966ca830c0d98e3.tar.gz", - "url_template": "https://github.com///archive/.tar.gz", - "version": "60fe72cf807a4ec4409a53883d5c3af77f60f721" - } -} diff --git a/nix/sources.nix b/nix/sources.nix deleted file mode 100644 index cde012b1ef5..00000000000 --- a/nix/sources.nix +++ /dev/null @@ -1,169 +0,0 @@ -# This file has been generated by Niv. - -let - - # - # The fetchers. fetch_ fetches specs of type . - # - - fetch_file = pkgs: spec: - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; } - else - pkgs.fetchurl { inherit (spec) url sha256; }; - - fetch_tarball = pkgs: name: spec: - let - ok = str: !builtins.isNull (builtins.match "[a-zA-Z0-9+-._?=]" str); - # sanitize the name, though nix will still fail if name starts with period - name' = stringAsChars (x: if !ok x then "-" else x) "${name}-src"; - in if spec.builtin or true then - builtins_fetchTarball { - name = name'; - inherit (spec) url sha256; - } - else - pkgs.fetchzip { - name = name'; - inherit (spec) url sha256; - }; - - fetch_git = spec: - builtins.fetchGit { - url = spec.repo; - inherit (spec) rev ref; - }; - - fetch_local = spec: spec.path; - - fetch_builtin-tarball = name: - throw '' - [${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=tarball -a builtin=true''; - - fetch_builtin-url = name: - throw '' - [${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=file -a builtin=true''; - - # - # Various helpers - # - - # The set of packages used when specs are fetched using non-builtins. - mkPkgs = sources: - let - sourcesNixpkgs = - import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) - { }; - hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; - hasThisAsNixpkgsPath = == ./.; - in if builtins.hasAttr "nixpkgs" sources then - sourcesNixpkgs - else if hasNixpkgsPath && !hasThisAsNixpkgsPath then - import { } - else - abort '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; - - # The actual fetching function. - fetch = pkgs: name: spec: - - if !builtins.hasAttr "type" spec then - abort "ERROR: niv spec ${name} does not have a 'type' attribute" - else if spec.type == "file" then - fetch_file pkgs spec - else if spec.type == "tarball" then - fetch_tarball pkgs name spec - else if spec.type == "git" then - fetch_git spec - else if spec.type == "local" then - fetch_local spec - else if spec.type == "builtin-tarball" then - fetch_builtin-tarball name - else if spec.type == "builtin-url" then - fetch_builtin-url name - else - abort - "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; - - # If the environment variable NIV_OVERRIDE_${name} is set, then use - # the path directly as opposed to the fetched source. - replace = name: drv: - let - saneName = stringAsChars - (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; - ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; - in if ersatz == "" then drv else ersatz; - - # Ports of functions for older nix versions - - # a Nix version of mapAttrs if the built-in doesn't exist - mapAttrs = builtins.mapAttrs or (f: set: - with builtins; - listToAttrs (map (attr: { - name = attr; - value = f attr set.${attr}; - }) (attrNames set))); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: - if first > last then - [ ] - else - builtins.genList (n: first + n) (last - first + 1); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 - stringToCharacters = s: - map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 - stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); - concatStrings = builtins.concatStringsSep ""; - - # fetchTarball version that is compatible between all the versions of Nix - builtins_fetchTarball = { url, name, sha256 }@attrs: - let inherit (builtins) lessThan nixVersion fetchTarball; - in if lessThan nixVersion "1.12" then - fetchTarball { inherit name url; } - else - fetchTarball attrs; - - # fetchurl version that is compatible between all the versions of Nix - builtins_fetchurl = { url, sha256 }@attrs: - let inherit (builtins) lessThan nixVersion fetchurl; - in if lessThan nixVersion "1.12" then - fetchurl { inherit url; } - else - fetchurl attrs; - - # Create the final "sources" from the config - mkSources = config: - mapAttrs (name: spec: - if builtins.hasAttr "outPath" spec then - abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); }) - config.sources; - - # The "config" used by the fetchers - mkConfig = { sourcesFile ? - if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then - { } - else - builtins.fromJSON (builtins.readFile sourcesFile), pkgs ? mkPkgs sources - }: rec { - # The sources, i.e. the attribute set of spec name to spec - inherit sources; - - # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers - inherit pkgs; - }; - -in mkSources (mkConfig { }) // { - __functor = _: settings: mkSources (mkConfig settings); -} diff --git a/nix/stack-shell.nix b/nix/stack-shell.nix deleted file mode 100644 index 2f9f943bd27..00000000000 --- a/nix/stack-shell.nix +++ /dev/null @@ -1,14 +0,0 @@ -with import ./. { }; - -haskell.lib.buildStackProject { - name = "stack-env"; - buildInputs = with pkgs; [ - zlib - openssl - gmp - libffi - git - haskellPackages.happy - ]; - ghc = (import ../shell.nix { inherit pkgs; }).ghc; -} diff --git a/nix/util.nix b/nix/util.nix deleted file mode 100644 index ab16b5ca336..00000000000 --- a/nix/util.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ haskell-nix }: - -with haskell-nix.haskellLib; { - - inherit selectProjectPackages collectChecks' collectComponents'; - - inherit (extra) recRecurseIntoAttrs; - -} diff --git a/nix/windows-testing-bundle.nix b/nix/windows-testing-bundle.nix deleted file mode 100644 index ca50f05289f..00000000000 --- a/nix/windows-testing-bundle.nix +++ /dev/null @@ -1,37 +0,0 @@ -# ########################################################################### -# Windows testing bundle -# -# This bundles up the windows build and its dependencies, adds an -# example self-node configuration, and some .BAT files for launching, -# and sets up the Hydra build artifact. -# -############################################################################ - -{ runCommand, lib, zip, project, tests ? [ ], benchmarks ? [ ] }: -let - - name = "ouroboros-network-${project.version}-tests-win64"; - -in runCommand name { - nativeBuildInputs = [ zip ]; - passthru = { inherit tests benchmarks; }; -} '' - mkdir -p $out/nix-support - - ${lib.concatMapStringsSep "\n" (test: '' - exe=`cd ${test}/bin; ls -1 *.exe` - mkdir -p ${test.packageName} - cp -r ${test}/bin/* ${test.packageName}/ - echo $exe >> ${test.packageName}/tests.bat - echo "if %errorlevel% neq 0 exit /b %errorlevel%" >> ${test.packageName}/tests.bat - '') tests} - - ${lib.concatMapStringsSep "\n" (benchmark: '' - mkdir -p ${benchmark.packageName} - cp -r ${benchmark}/bin/* ${benchmark.packageName}/ - '') benchmarks} - - chmod -R +w . - zip -r $out/${name}.zip . - echo "file binary-dist $out/${name}.zip" > $out/nix-support/hydra-build-products -'' diff --git a/release.nix b/release.nix deleted file mode 100644 index 3bc38d321b9..00000000000 --- a/release.nix +++ /dev/null @@ -1,161 +0,0 @@ -# ########################################################################### -# -# Hydra release jobset. -# -# The purpose of this file is to select jobs defined in default.nix and map -# them to all supported build platforms. -# -############################################################################ - -# The project sources -{ ouroboros-network ? { - outPath = ./.; - rev = "abcdef"; -} - -# Function arguments to pass to the project -, projectArgs ? { - inherit sourcesOverride; - config = { - allowUnfree = false; - inHydra = true; - }; - gitrev = ouroboros-network.rev; -} - -# The systems that the jobset will be built for. -, supportedSystems ? [ - "x86_64-linux" - "x86_64-darwin" -] - -# The systems used for cross-compiling (default: linux) -, supportedCrossSystems ? - (builtins.filter (s: s == "x86_64-linux") supportedSystems) - - # Cross compilation to Windows is currently only supported on linux. -, windowsBuild ? builtins.elem "x86_64-linux" supportedCrossSystems - - # A Hydra option -, scrubJobs ? true - -, withProblematicWindowsTests ? false - - # Dependencies overrides -, sourcesOverride ? { } - - # Import pkgs, including IOHK common nix lib -, pkgs ? import ./nix { - inherit sourcesOverride; - system = __head supportedSystems; -} - -}: - -with (import pkgs.iohkNix.release-lib) { - inherit pkgs; - inherit supportedSystems supportedCrossSystems scrubJobs projectArgs; - packageSet = import ouroboros-network; - gitrev = ouroboros-network.rev; -}; - -with pkgs.lib; -let - # restrict supported systems to a subset where tests (if exist) are required to pass: - testsSupportedSystems = - intersectLists supportedSystems [ "x86_64-linux" "x86_64-darwin" ]; - # Recurse through an attrset, returning all derivations in a list matching test supported systems. - collectJobs' = ds: - filter (d: elem d.system testsSupportedSystems) (collect isDerivation ds); - # Adds the package name to the derivations for windows-testing-bundle.nix - # (passthru.identifier.name does not survive mapTestOn) - collectJobs = ds: - concatLists (mapAttrsToList (packageName: package: - map (drv: drv // { inherit packageName; }) (collectJobs' package)) ds); - - nonDefaultBuildSystems = tail supportedSystems; - - # Paths or prefixes of paths of derivations to build only on the default system (ie. linux on hydra): - onlyBuildOnDefaultSystem = [ [ "network-docs" ] ]; - # Paths or prefix of paths for which cross-builds (mingwW64, musl64) are disabled: - noCrossBuild = let - # checks are available from two path: - checksPaths = path: [ - ([ "checks" "tests" ] ++ path) - ([ "haskellPackages" (head path) "checks" ] ++ (tail path)) - ]; - # as well as tests: - testsPaths = path: [ - ([ "tests" ] ++ path) - ([ "haskellPackages" (head path) "components" "tests" ] ++ (tail path)) - ]; - # as well as exes: - exesPaths = path: [ - ([ "exes" ] ++ path) - ([ "haskellPackages" (head path) "components" "exes" ] ++ (tail path)) - ]; - in [ [ "shell" ] ] ++ (optionals (!withProblematicWindowsTests) - ((checksPaths [ "ouroboros-network" "test" ]) - ++ (checksPaths [ "monoidal-synchronisation" "test" ]) - ++ (checksPaths [ "Win32-network" "test" ]) - ++ (checksPaths [ "network-mux" "test" ]) - ++ (checksPaths [ "ouroboros-network-framework" "test" ]) - ++ (checksPaths [ "ouroboros-network-protocols" "test" ]) - ++ (checksPaths [ "ouroboros-network-protocols" "cddl" ]) - ++ (checksPaths [ "ouroboros-network-testing" "test" ]) ++ [ - [ "haskellPackages" "ouroboros-network" "coverageReport" ] - [ "haskellPackages" "Win32-network" "coverageReport" ] - [ "haskellPackages" "network-mux" "coverageReport" ] - [ - "haskellPackages" - "ouroboros-network-protocols-test" - "coverageReport" - ] - [ "haskellPackages" "ouroboros-network-framework" "coverageReport" ] - [ "haskellPackages" "ouroboros-network-testing" "coverageReport" ] - ])) ++ (testsPaths [ "ouroboros-network-protocols-test" "cddl" ]) - ++ (exesPaths [ "network-mux" ]) ++ [[ "checks" "styles" ]] - ++ onlyBuildOnDefaultSystem; - - # Remove build jobs for which cross compiling does not make sense. - filterProject = noBuildList: - mapAttrsRecursiveCond (a: !(isDerivation a)) (path: value: - if (isDerivation value - && (any (p: take (length p) path == p) noBuildList)) then - null - else - value) project; - - inherit (systems.examples) mingwW64 musl64; - - jobs = { - native = let - filteredBuilds = mapAttrsRecursiveCond (a: !(isList a)) (path: value: - if (any (p: take (length p) path == p) onlyBuildOnDefaultSystem) then - filter (s: !(elem s nonDefaultBuildSystems)) value - else - value) (packagePlatforms project); - in (mapTestOn (__trace (__toJSON filteredBuilds) filteredBuilds)); - # TODO: fix broken evals - #musl64 = mapTestOnCross musl64 (packagePlatformsCross project); - } // (optionalAttrs windowsBuild { - "${mingwW64.config}" = mapTestOnCross mingwW64 - (packagePlatformsCross (filterProject noCrossBuild)); - }) // (mkRequiredJob (concatLists [ - (collectJobs jobs.native.shell) - (collectJobs jobs.native.checks) - (collectJobs jobs.native.benchmarks) - (collectJobs jobs.native.libs) - (collectJobs jobs.native.exes) - ] ++ lib.optionals windowsBuild - (collectJobs jobs."${mingwW64.config}".checks.tests))) // { - # This is used for testing the build on windows. - ouroboros-network-tests-win64 = - pkgs.callPackage ./nix/windows-testing-bundle.nix { - inherit project; - tests = collectJobs jobs."${mingwW64.config}".tests; - benchmarks = collectJobs jobs."${mingwW64.config}".benchmarks; - }; - }; - -in jobs