From 8c7c3e2df25362704876034fa750b715846c461d Mon Sep 17 00:00:00 2001 From: John Lotoski Date: Tue, 26 May 2026 20:15:53 -0500 Subject: [PATCH] nix: add flake --- .gitmodules | 6 +- flake.lock | 759 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 58 +++ flake/lib.nix | 38 ++ perSystem/devShells.nix | 28 ++ perSystem/hydraJobs.nix | 24 ++ perSystem/packages.nix | 11 + perSystem/project.nix | 71 ++++ 8 files changed, 992 insertions(+), 3 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 flake/lib.nix create mode 100644 perSystem/devShells.nix create mode 100644 perSystem/hydraJobs.nix create mode 100644 perSystem/packages.nix create mode 100644 perSystem/project.nix diff --git a/.gitmodules b/.gitmodules index f0a525a..afd2682 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "config"] path = config - url = git@github.com:input-output-hk/cardano-configurations.git + url = https://github.com/input-output-hk/cardano-configurations.git [submodule "test/ogmios"] path = test/vectors/ogmios - url = git@github.com:cardanosolutions/ogmios.git + url = https://github.com/cardanosolutions/ogmios.git [submodule "test/vectors/hydra"] path = test/vectors/hydra - url = git@github.com:input-output-hk/hydra.git + url = https://github.com/input-output-hk/hydra.git diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4bd2612 --- /dev/null +++ b/flake.lock @@ -0,0 +1,759 @@ +{ + "nodes": { + "CHaP": { + "flake": false, + "locked": { + "lastModified": 1779802675, + "narHash": "sha256-LQN0f9GBBmYMo9tQ/11EvU5tAEOhGtQnU2UP3S78cqg=", + "owner": "intersectmbo", + "repo": "cardano-haskell-packages", + "rev": "b8c7b848cdb6d08e414c37d026c300200f8c1b5b", + "type": "github" + }, + "original": { + "owner": "intersectmbo", + "ref": "repo", + "repo": "cardano-haskell-packages", + "type": "github" + } + }, + "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": 1749204514, + "narHash": "sha256-Q9/zGN93TnJt2c8YvSaURstoxT02ts3nVkO5V08m4TI=", + "owner": "supranational", + "repo": "blst", + "rev": "6d960cd05d6fe2b5bc9ba161edf0c1a131b87c4c", + "type": "github" + }, + "original": { + "owner": "supranational", + "ref": "v0.3.15", + "repo": "blst", + "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-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1778716662, + "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "hackage-for-stackage": { + "flake": false, + "locked": { + "lastModified": 1779756795, + "narHash": "sha256-bzFkGq3myTc6t7BN4riMdhe6s7XSXtJq7erPQDHrCYU=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "6e821564270a208b06fcabd00700ec733fc5fc50", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "for-stackage", + "repo": "hackage.nix", + "type": "github" + } + }, + "hackage-internal": { + "flake": false, + "locked": { + "lastModified": 1750307553, + "narHash": "sha256-iiafNoeLHwlSLQTyvy8nPe2t6g5AV4PPcpMeH/2/DLs=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "f7867baa8817fab296528f4a4ec39d1c7c4da4f3", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "hackageNix": { + "flake": false, + "locked": { + "lastModified": 1779824738, + "narHash": "sha256-o4W05VYZ0hlIA/BXxL6hYsQ9HL6JsawxepFnCh429R8=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "decbe184cfce30ea802ea95c874511f776a4b48a", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskellNix": { + "inputs": { + "HTTP": "HTTP", + "cabal-34": "cabal-34", + "cabal-36": "cabal-36", + "cardano-shell": "cardano-shell", + "flake-compat": "flake-compat", + "hackage": [ + "hackageNix" + ], + "hackage-for-stackage": "hackage-for-stackage", + "hackage-internal": "hackage-internal", + "hls": "hls", + "hls-1.10": "hls-1.10", + "hls-2.0": "hls-2.0", + "hls-2.10": "hls-2.10", + "hls-2.11": "hls-2.11", + "hls-2.12": "hls-2.12", + "hls-2.2": "hls-2.2", + "hls-2.3": "hls-2.3", + "hls-2.4": "hls-2.4", + "hls-2.5": "hls-2.5", + "hls-2.6": "hls-2.6", + "hls-2.7": "hls-2.7", + "hls-2.8": "hls-2.8", + "hls-2.9": "hls-2.9", + "hpc-coveralls": "hpc-coveralls", + "iserv-proxy": "iserv-proxy", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-2311": "nixpkgs-2311", + "nixpkgs-2405": "nixpkgs-2405", + "nixpkgs-2411": "nixpkgs-2411", + "nixpkgs-2505": "nixpkgs-2505", + "nixpkgs-2511": "nixpkgs-2511", + "nixpkgs-unstable": "nixpkgs-unstable", + "old-ghc-nix": "old-ghc-nix", + "stackage": "stackage" + }, + "locked": { + "lastModified": 1779758596, + "narHash": "sha256-+JyDKZj0sKUxZHI1oID4oLrJdNSQaJO5ziaid0Zn07E=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "daad9b0ee7e087911c484b445d9045056e5a7450", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, + "hls": { + "flake": false, + "locked": { + "lastModified": 1741604408, + "narHash": "sha256-tuq3+Ip70yu89GswZ7DSINBpwRprnWnl6xDYnS4GOsc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "682d6894c94087da5e566771f25311c47e145359", + "type": "github" + }, + "original": { + "owner": "haskell", + "repo": "haskell-language-server", + "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" + } + }, + "hls-2.10": { + "flake": false, + "locked": { + "lastModified": 1743069404, + "narHash": "sha256-q4kDFyJDDeoGqfEtrZRx4iqMVEC2MOzCToWsFY+TOzY=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "2318c61db3a01e03700bd4b05665662929b7fe8b", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.10.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.11": { + "flake": false, + "locked": { + "lastModified": 1747306193, + "narHash": "sha256-/MmtpF8+FyQlwfKHqHK05BdsxC9LHV70d/FiMM7pzBM=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "46ef4523ea4949f47f6d2752476239f1c6d806fe", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.11.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.12": { + "flake": false, + "locked": { + "lastModified": 1758709460, + "narHash": "sha256-xkI8MIIVEVARskfWbGAgP5sHG/lyeKnkm0LIOJ19X5w=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "7d983de4fa7ff54369f6dd31444bdb9869aec83e", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.12.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.2": { + "flake": false, + "locked": { + "lastModified": 1693064058, + "narHash": "sha256-8DGIyz5GjuCFmohY6Fa79hHA/p1iIqubfJUTGQElbNk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "b30f4b6cf5822f3112c35d14a0cba51f3fe23b85", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.2.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.3": { + "flake": false, + "locked": { + "lastModified": 1695910642, + "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.3.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.4": { + "flake": false, + "locked": { + "lastModified": 1699862708, + "narHash": "sha256-YHXSkdz53zd0fYGIYOgLt6HrA0eaRJi9mXVqDgmvrjk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "54507ef7e85fa8e9d0eb9a669832a3287ffccd57", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.4.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.5": { + "flake": false, + "locked": { + "lastModified": 1701080174, + "narHash": "sha256-fyiR9TaHGJIIR0UmcCb73Xv9TJq3ht2ioxQ2mT7kVdc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "27f8c3d3892e38edaef5bea3870161815c4d014c", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.5.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.6": { + "flake": false, + "locked": { + "lastModified": 1705325287, + "narHash": "sha256-+P87oLdlPyMw8Mgoul7HMWdEvWP/fNlo8jyNtwME8E8=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "6e0b342fa0327e628610f2711f8c3e4eaaa08b1e", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.6.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.7": { + "flake": false, + "locked": { + "lastModified": 1708965829, + "narHash": "sha256-LfJ+TBcBFq/XKoiNI7pc4VoHg4WmuzsFxYJ3Fu+Jf+M=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "50322b0a4aefb27adc5ec42f5055aaa8f8e38001", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.7.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.8": { + "flake": false, + "locked": { + "lastModified": 1715153580, + "narHash": "sha256-Vi/iUt2pWyUJlo9VrYgTcbRviWE0cFO6rmGi9rmALw0=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "dd1be1beb16700de59e0d6801957290bcf956a0a", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.8.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.9": { + "flake": false, + "locked": { + "lastModified": 1719993701, + "narHash": "sha256-wy348++MiMm/xwtI9M3vVpqj2qfGgnDcZIGXw8sF1sA=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "90319a7e62ab93ab65a95f8f2bcf537e34dae76a", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.9.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" + } + }, + "iohkNix": { + "inputs": { + "blst": "blst", + "nixpkgs": "nixpkgs", + "secp256k1": "secp256k1", + "sodium": "sodium" + }, + "locked": { + "lastModified": 1777941182, + "narHash": "sha256-FX3+8GIrB2z4akmcYTStELDKVJWgqy9yFt0mxwpU3Qc=", + "owner": "input-output-hk", + "repo": "iohk-nix", + "rev": "9de00113c11ba8cac908a63acf34b193cda7475b", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "iohk-nix", + "type": "github" + } + }, + "iserv-proxy": { + "flake": false, + "locked": { + "lastModified": 1775620557, + "narHash": "sha256-10x8/G0x3eR/++XRHPx4MBuqlnc6+N+ajIxXyLkG+nU=", + "owner": "stable-haskell", + "repo": "iserv-proxy", + "rev": "3f7b2815307c20a0dfd816bdf4a39ab86af3e0d4", + "type": "github" + }, + "original": { + "owner": "stable-haskell", + "ref": "iserv-syms", + "repo": "iserv-proxy", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1751071626, + "narHash": "sha256-/uHE/AD2qGq4QLigWAnBHiVvpVXB04XAfrOtw8JMv+Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a47938d89bdf8e279ad432bd6a473cf4c430f48c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2305": { + "locked": { + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2311": { + "locked": { + "lastModified": 1719957072, + "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2405": { + "locked": { + "lastModified": 1735564410, + "narHash": "sha256-HB/FA0+1gpSs8+/boEavrGJH+Eq08/R2wWNph1sM1Dg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e7a8f391f1a490460760065fa0630b5520f9cf8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2411": { + "locked": { + "lastModified": 1751290243, + "narHash": "sha256-kNf+obkpJZWar7HZymXZbW+Rlk3HTEIMlpc6FCNz0Ds=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5ab036a8d97cb9476fbe81b09076e6e91d15e1b6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2505": { + "locked": { + "lastModified": 1764560356, + "narHash": "sha256-M5aFEFPppI4UhdOxwdmceJ9bDJC4T6C6CzCK1E2FZyo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6c8f0cca84510cc79e09ea99a299c9bc17d03cb6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2511": { + "locked": { + "lastModified": 1775749320, + "narHash": "sha256-msT6frWJSQ2WR+0cpk+KPcZdLTLagUIsJwQwIX9JNSo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "74b87959b2d16f59f54d8559cf3cf26b9d907949", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1777168982, + "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1775888245, + "narHash": "sha256-nwASzrRDD1JBEu/o8ekKYEXm/oJW6EMCzCRdrwcLe90=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "13043924aaa7375ce482ebe2494338e058282925", + "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": { + "CHaP": "CHaP", + "flake-parts": "flake-parts", + "hackageNix": "hackageNix", + "haskellNix": "haskellNix", + "iohkNix": "iohkNix", + "nixpkgs": [ + "haskellNix", + "nixpkgs-unstable" + ] + } + }, + "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": 1675156279, + "narHash": "sha256-0uRcN5gvMwO7MCXVYnoqG/OmeBFi8qRVnDWJLnBb9+Y=", + "owner": "input-output-hk", + "repo": "libsodium", + "rev": "dbb48cce5429cb6585c9034f002568964f1ce567", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "libsodium", + "rev": "dbb48cce5429cb6585c9034f002568964f1ce567", + "type": "github" + } + }, + "stackage": { + "flake": false, + "locked": { + "lastModified": 1779755768, + "narHash": "sha256-XLsul3En+6EtiTvcL9uV+V5wQmL0m79/840uzm2woME=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "87da112372b268c4bd57080ddcc1b63d33a9a375", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..37ec19b --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + inputs = { + CHaP = { + url = "github:intersectmbo/cardano-haskell-packages?ref=repo"; + flake = false; + }; + hackageNix = { + url = "github:input-output-hk/hackage.nix"; + flake = false; + }; + haskellNix = { + url = "github:input-output-hk/haskell.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.hackage.follows = "hackageNix"; + }; + flake-parts.url = "github:hercules-ci/flake-parts"; + iohkNix.url = "github:input-output-hk/iohk-nix"; + nixpkgs.follows = "haskellNix/nixpkgs-unstable"; + self.submodules = true; + }; + + outputs = inputs: + let + inherit ((import ./flake/lib.nix { inherit inputs; }).flake.lib) recursiveImports; + in + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + imports = recursiveImports [ ./perSystem ]; + systems = [ + "x86_64-linux" + # "aarch64-linux" + # "aarch64-darwin" + ]; + perSystem = { system, ... }: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + inherit (inputs.haskellNix) config; + overlays = [ + inputs.iohkNix.overlays.crypto + inputs.haskellNix.overlay + inputs.iohkNix.overlays.haskell-nix-extra + inputs.iohkNix.overlays.haskell-nix-crypto + inputs.iohkNix.overlays.cardano-lib + inputs.iohkNix.overlays.utils + ]; + }; + }; + }; + + nixConfig = { + 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/flake/lib.nix b/flake/lib.nix new file mode 100644 index 0000000..56279e7 --- /dev/null +++ b/flake/lib.nix @@ -0,0 +1,38 @@ +{inputs, ...}: { + flake.lib = inputs.nixpkgs.lib.extend (_self: lib: { + recursiveImports = let + # Recursively constructs an attrset of a given folder, recursing on + # directories, value of attrs is the filetype + getDir = dir: + lib.mapAttrs + ( + file: type: + if type == "directory" + then getDir "${dir}/${file}" + else type + ) + (builtins.readDir dir); + + # Collects all files of a directory as a list of strings of paths + files = path: + if lib.pathType path == "directory" + then + lib.collect lib.isString (lib.mapAttrsRecursive + (path: _type: lib.concatStringsSep "/" path) + (getDir path)) + else [path]; + + # Filters out files that don't end with .nix and also make the strings absolute path based + validFiles = path: + map + (file: + if lib.hasPrefix "/nix/store" file + then file + else path + "/${file}") + (lib.filter + (lib.hasSuffix ".nix") + (files path)); + in + lib.concatMap validFiles; + }); +} diff --git a/perSystem/devShells.nix b/perSystem/devShells.nix new file mode 100644 index 0000000..e77795b --- /dev/null +++ b/perSystem/devShells.nix @@ -0,0 +1,28 @@ +{ inputs, ... }: { + perSystem = { shellFor, pkgs, ... }: { + devShells.default = shellFor { + packages = p: [ p.kupo ]; + + nativeBuildInputs = [ + pkgs.jq + pkgs.gh + ]; + + tools = { + cabal = "latest"; + ghcid = "latest"; + haskell-language-server = { + src = inputs.haskellNix.inputs."hls-2.10"; + configureArgs = "--disable-benchmarks --disable-tests"; + }; + }; + + shellHook = '' + export LANG="en_US.UTF-8" + git submodule update --init --recursive + ''; + + withHoogle = false; + }; + }; +} diff --git a/perSystem/hydraJobs.nix b/perSystem/hydraJobs.nix new file mode 100644 index 0000000..de9782d --- /dev/null +++ b/perSystem/hydraJobs.nix @@ -0,0 +1,24 @@ +{ config, lib, withSystem, ... }: { + flake.hydraJobs = lib.genAttrs config.systems (lib.flip withSystem ( + { + config, + pkgs, + ... + }: let + required = {inherit (config) packages checks;}; + nonRequired = {inherit (config) devShells;}; + jobs = required // nonRequired; + in + jobs + // { + required = pkgs.releaseTools.aggregate { + name = "required"; + constituents = lib.collect lib.isDerivation required; + }; + nonrequired = pkgs.releaseTools.aggregate { + name = "nonrequired"; + constituents = lib.collect lib.isDerivation nonRequired; + }; + } + )); +} diff --git a/perSystem/packages.nix b/perSystem/packages.nix new file mode 100644 index 0000000..5a86161 --- /dev/null +++ b/perSystem/packages.nix @@ -0,0 +1,11 @@ +{ + perSystem = { hsPkgs, ... }: + let + kupo = hsPkgs.kupo; + in + { + packages.kupo = kupo.components.library; + packages.kupo-exe = kupo.components.exes.kupo; + checks.kupo-unit = kupo.checks.unit; + }; +} diff --git a/perSystem/project.nix b/perSystem/project.nix new file mode 100644 index 0000000..c12e2bf --- /dev/null +++ b/perSystem/project.nix @@ -0,0 +1,71 @@ +{ inputs, self, ... }: + +{ + perSystem = { pkgs, lib, ... }: + let + project = pkgs.haskell-nix.cabalProject' ({ config, pkgs, ... }: { + src = pkgs.haskell-nix.haskellLib.cleanSourceWith { + name = "kupo-src"; + src = self; + # Filter out package.yaml files so plan-to-nix uses the + # pre-generated .cabal files instead. The package.yaml files + # `!include` .hpack.config.yaml via relative paths that the + # haskell.nix sandbox can't always resolve. + filter = path: type: + builtins.all (x: x) [ + (baseNameOf path != "package.yaml") + ]; + }; + name = "kupo"; + compiler-nix-name = lib.mkDefault "ghc984"; + + inputMap = { + "https://input-output-hk.github.io/cardano-haskell-packages" = inputs.CHaP; + }; + + # Mirrors source-repository-package entries in cabal.project so + # haskell.nix can fetch them deterministically. + sha256map = { + "https://github.com/CardanoSolutions/ogmios"."ae876badb138f42dcd6d2389734b0c15502684ed" = "sha256-xkOfOdX6Dxi7+VW78Tk3n3MoguIg39pKdxiNVfdeEwE="; + "https://github.com/CardanoSolutions/sqlite-simple"."08015be2ee52a7e67159b6b0c476bd3e0a2e0b87" = "1ahpjycsfibv09kzgfbm4i55z4nz1p3rvnmfwwwraxy45n1ivl85"; + "https://github.com/CardanoSolutions/direct-sqlite"."2b14a78cb73805e2e5d84354230e872a223faa39" = "1lwaariy0zjjh006ll1zbpdi9sphyqmcbbxhb0rj99nii5s91fd7"; + "https://github.com/CardanoSolutions/text-ansi"."e204822d2f343b2d393170a2ec46ee935571345c" = "16ki7wsf7wivxn65acv4hxwfrzmphq4zp61lpxwzqkgrg8shi8bv"; + }; + + modules = [ + { + doHaddock = false; + packages.kupo.ghcOptions = [ "-Werror" ]; + # GHC 9.8 enabled -Wx-partial by default; kupo was written for + # 9.6 and uses `Prelude.head` in a handful of test spots. + # Silence it under -Werror until the source is updated. + packages.kupo.components.tests.unit.ghcOptions = [ "-Wno-x-partial" ]; + + # Tests use relative paths like `./test/vectors/...` and + # `./config/network/.../config.json`. The default test runCommand + # CWD is empty, so populate it with the vectors tree and the + # cardano-configurations submodule before invoking the binary. + packages.kupo.components.tests.unit.preCheck = '' + cp -r ${self}/test/vectors ./test/vectors + cp -r ${self}/config ./config + ''; + } + ({ pkgs, ... }: { + # Use the VRF fork of libsodium + packages = { + cardano-crypto-praos.components.library.pkgconfig = pkgs.lib.mkForce [ + [ pkgs.libsodium-vrf ] + ]; + cardano-crypto-class.components.library.pkgconfig = pkgs.lib.mkForce [ + [ pkgs.libsodium-vrf pkgs.secp256k1 pkgs.libblst ] + ]; + }; + }) + ]; + }); + in + { + _module.args.hsPkgs = project.hsPkgs; + _module.args.shellFor = args: project.shellFor args; + }; +}