From db9d270ce3f55c77001fe5809995ed15492c03bf Mon Sep 17 00:00:00 2001 From: Yurii Pytomets Date: Thu, 20 Feb 2025 15:05:07 +0200 Subject: [PATCH] feat(#97): update nix flake - Update to Atlas v0.11.1 --- cabal.project | 66 +++--- flake.lock | 146 +++++++------ flake.nix | 78 ++++++- .../geniusyield-market-maker.cabal | 4 +- nix.md | 191 ++++++++++++++++++ nix/hix.nix | 25 --- 6 files changed, 383 insertions(+), 127 deletions(-) create mode 100644 nix.md delete mode 100644 nix/hix.nix diff --git a/cabal.project b/cabal.project index ed8c980..56f67df 100644 --- a/cabal.project +++ b/cabal.project @@ -1,5 +1,5 @@ repository cardano-haskell-packages - url: https://input-output-hk.github.io/cardano-haskell-packages + url: https://chap.intersectmbo.org/ secure: True root-keys: 3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f @@ -10,11 +10,12 @@ repository cardano-haskell-packages d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee -- repeating the index-state for hackage to work around hackage.nix parsing limitation -index-state: 2024-08-27T16:28:01Z +index-state: 2025-01-14T23:25:37Z +-- NOTE: Do not bump chap index beyond that used by target cardano-node version. index-state: - , hackage.haskell.org 2024-08-27T16:28:01Z - , cardano-haskell-packages 2024-07-24T14:16:32Z + , hackage.haskell.org 2025-01-14T23:25:37Z + , cardano-haskell-packages 2025-02-15T18:39:38Z packages: . packages: geniusyield-annset @@ -27,8 +28,8 @@ test-show-details: direct source-repository-package type: git location: https://github.com/geniusyield/dex-contracts-api - tag: v0.11.0 - --sha256: sha256-fV6jQVxoPfv1DdssmuHDmyvKcFpFCReiSeZ3n76zC9M= + tag: bb81fc95bfa5132bc4bb18db2cd182221eccf1b4 + --sha256: sha256-BEXMgTeERUpqgMFXpC2Eib9LGoMnOq/XoBiXjEPc//w= subdir: geniusyield-dex-api geniusyield-onchain/geniusyield-common @@ -36,15 +37,15 @@ source-repository-package source-repository-package type: git location: https://github.com/geniusyield/ply - tag: 4a61941b3287782d2c11f9ab1cae0889d0a57385 - --sha256: sha256-24WKaBs6qiJzi++wTyqIh61Dc1QeCzeo0YqLE4wsEbg= + tag: 93306f5ad3e7db7c8519d446cc1503802fd047db + --sha256: sha256-S8gQqrIDiSewhfXPIMjtnEor4r8q2g/Vm7N/FWet5yc= subdir: ply-core source-repository-package type: git location: https://github.com/geniusyield/atlas - tag: v0.6.0 - --sha256: sha256-v+tTCIz8uyaQfsMJRc5F36TNK9ZPfrBxwXLYaXqZrZA= + tag: v0.11.1 + --sha256: sha256-leT3lll0Fms4fjPuRqUBSRqjl28ARI+vIs1Xn14VO98= -------- Begin contents from @atlas@'s @cabal.project@ file. -------- @@ -54,33 +55,32 @@ package cardano-crypto-praos source-repository-package type: git location: https://github.com/maestro-org/haskell-sdk - tag: v1.7.2 - --sha256: sha256-nXnelHH4a+V0nguP8oUDlyEz/fLQ/i1fs/flyZTmvAc= + tag: v1.7.3 + --sha256: sha256-FYZMbh9Uz+RIjjXIf3PBK94mhd1XMX/wxHDA9LukvQg= -- TODO: Temporary, until proposed changes are in upstream (track https://github.com/mlabs-haskell/clb/pull/44) source-repository-package type: git location: https://github.com/sourabhxyz/clb - tag: 09414a93047b4c7f6e03e20d1730c9c0f88e1d46 - --sha256: sha256-y5fF8IDywt/pQ3HsRE6CpAlqK4uiU/SRuDIqSHxBED0= + tag: 257475d987994db8dc5b1b27c9cdf6d6ea547a2c + --sha256: sha256-Tf9Pxh0W1cyvqPKKA07VVZCOLJBMk8W7BVLV+jwZeOM= + subdir: + clb --- Obtaining cardano-node stuff for 9.1.0. These aren't published on CHaP yet. +-- Obtaining cardano-node stuff for 10.1.3. These aren't published on CHaP yet. source-repository-package type: git location: https://github.com/IntersectMBO/cardano-node - tag: 9.1.0 - --sha256: sha256-F5wgRA820x16f+8c/LlEEBG0rMJIA1XWw6X0ZwX5UWs= + tag: 10.1.3 + --sha256: sha256-v0q8qHdI6LKc8mP43QZt3UGdTNDQXE0aF6QapvZsTvU= subdir: - cardano-node cardano-testnet - trace-dispatcher --- TODO: Make changes upstream source-repository-package type: git - location: https://github.com/geniusyield/cardano-wallet - tag: 3413fdf74fd25b100662abf2a49c1afc892f1b79 - --sha256: sha256-V5DNUzraaDJo6cXc1eeVVIJNWqC8JayQrJeNNLg/Els= + location: https://github.com/cardano-foundation/cardano-wallet + tag: 630ef0067c2c0df1b398256d75923db928beefa1 + --sha256: sha256-0iDG3LW60pb+ih+nfqQ3vR+WI7JEm+0kI3Vg7jqm1L0= subdir: lib/address-derivation-discovery lib/balance-tx/ @@ -94,7 +94,6 @@ source-repository-package lib/network-layer/ lib/numeric/ lib/primitive/ - lib/read lib/secrets lib/std-gen-seed/ lib/test-utils/ @@ -103,6 +102,15 @@ source-repository-package lib/wallet-benchmarks/ lib/wallet/ +source-repository-package + type: git + location: https://github.com/cardano-foundation/cardano-wallet-agda + tag: f3479b501a2efe50bcf1ee0d09bc2d1325a982e7 + --sha256: 10d6k7mw1zw9vpzz8dhb52vfmj2rshsk225nvyl8nrc94fr627kz + subdir: + lib/customer-deposit-wallet-pure + lib/cardano-wallet-read + ------ Following is mostly from @cardano-wallet@'s @cabal.project@ file. ------- -------------------------------------------------------------------------------- @@ -162,9 +170,10 @@ constraints: base >= 4.18.2.0 && < 5 , openapi3 >= 3.2.0 , persistent ^>= 2.14.6.0 - , cardano-node ^>= 9.1.0 + , cardano-node ^>= 10.1.3 , bech32 >= 1.1.7 + -- lower versions of katip won't build with the Win32-2.12.0.1 -- which is shipped with the ghc-9.2.8 , katip >= 0.8.7.4 @@ -173,9 +182,10 @@ constraints: -- Cardano Node dependencies: , io-classes >= 1.4 , io-classes -asserts - , ouroboros-consensus-cardano ^>= 0.18 - , ouroboros-network ^>= 0.16.1 - , ouroboros-network-protocols ^>= 0.9 + + , ouroboros-consensus-cardano ^>= 0.20.0.0 + , ouroboros-network ^>= 0.17.1.2 + , ouroboros-network-protocols ^>= 0.11.0.0 -- END Constraints tweaking section -------------------------------------------------------------------------------- diff --git a/flake.lock b/flake.lock index b533385..9c44870 100644 --- a/flake.lock +++ b/flake.lock @@ -3,15 +3,15 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1715357583, - "narHash": "sha256-UdvQfk7No0b2L68tNjbOwnnR9PU30x93FzJTIwaXT60=", - "owner": "input-output-hk", + "lastModified": 1739645821, + "narHash": "sha256-HjAchUMLsiScm8Jyd+I/5YJKUjDp1r+XFzr05d+o+r4=", + "owner": "IntersectMBO", "repo": "cardano-haskell-packages", - "rev": "3a1dae0cd9af0e2e8734d73a9acbe2cdfff369d0", + "rev": "48b941c5729384f38b79c6f473ddbf920cb310ea", "type": "github" }, "original": { - "owner": "input-output-hk", + "owner": "IntersectMBO", "ref": "repo", "repo": "cardano-haskell-packages", "type": "github" @@ -152,51 +152,14 @@ "type": "github" } }, - "ghc910X": { - "flake": false, - "locked": { - "lastModified": 1714520650, - "narHash": "sha256-4uz6RA1hRr0RheGNDM49a/B3jszqNNU8iHIow4mSyso=", - "ref": "ghc-9.10", - "rev": "2c6375b9a804ac7fca1e82eb6fcfc8594c67c5f5", - "revCount": 62663, - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - }, - "original": { - "ref": "ghc-9.10", - "submodules": true, - "type": "git", - "url": "https://gitlab.haskell.org/ghc/ghc" - } - }, - "ghc911": { - "flake": false, - "locked": { - "lastModified": 1714817013, - "narHash": "sha256-m2je4UvWfkgepMeUIiXHMwE6W+iVfUY38VDGkMzjCcc=", - "ref": "refs/heads/master", - "rev": "fc24c5cf6c62ca9e3c8d236656e139676df65034", - "revCount": 62816, - "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": { - "lastModified": 1715474112, - "narHash": "sha256-nJKMnJ+HVD2xcdtF3Pl1pmU2Bent6yEoC6Dg6NevHlw=", + "lastModified": 1736900878, + "narHash": "sha256-gNHrCM1JydFpNhBLwniPVjZG8Z5TUVyI/A01NmdqZeE=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "25618a5293d11ef32e37bc10070783c3f720fa3a", + "rev": "d042ec3dc44f5d15d908251c9e724ee8c017a065", "type": "github" }, "original": { @@ -214,8 +177,6 @@ "cardano-shell": "cardano-shell", "flake-compat": "flake-compat", "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", - "ghc910X": "ghc910X", - "ghc911": "ghc911", "hackage": "hackage", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", @@ -225,6 +186,8 @@ "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", "hydra": "hydra", "iserv-proxy": "iserv-proxy", @@ -239,16 +202,17 @@ "nixpkgs-2211": "nixpkgs-2211", "nixpkgs-2305": "nixpkgs-2305", "nixpkgs-2311": "nixpkgs-2311", + "nixpkgs-2405": "nixpkgs-2405", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1715475035, - "narHash": "sha256-PSY9tTGImNB2glCnwNRg1g0HhL17gqnTkLzhsiRtFaE=", + "lastModified": 1736902273, + "narHash": "sha256-7x+uEZ8wgm3gocNgST5RQ5a1xEp4Is+VwGICqEgo/BM=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "c65b5a202520ccdf2cb435351d9e10545881cae4", + "rev": "94a061666cbd39c32468efed72dca29cf716c90a", "type": "github" }, "original": { @@ -393,6 +357,40 @@ "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": 1720003792, + "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.9.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, "hpc-coveralls": { "flake": false, "locked": { @@ -435,11 +433,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1708894040, - "narHash": "sha256-Rv+PajrnuJ6AeyhtqzMN+bcR8z9+aEnrUass+N951CQ=", + "lastModified": 1717479972, + "narHash": "sha256-7vE3RQycHI1YT9LHJ1/fUaeln2vIpYm6Mmn8FTpYeVo=", "owner": "stable-haskell", "repo": "iserv-proxy", - "rev": "2f2a318fd8837f8063a0d91f329aeae29055fba9", + "rev": "2ed34002247213fc435d0062350b91bab920626e", "type": "github" }, "original": { @@ -584,11 +582,11 @@ }, "nixpkgs-2305": { "locked": { - "lastModified": 1701362232, - "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", "type": "github" }, "original": { @@ -600,11 +598,11 @@ }, "nixpkgs-2311": { "locked": { - "lastModified": 1701386440, - "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "lastModified": 1719957072, + "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", "type": "github" }, "original": { @@ -614,6 +612,22 @@ "type": "github" } }, + "nixpkgs-2405": { + "locked": { + "lastModified": 1729242558, + "narHash": "sha256-VgcLDu4igNT0eYua6OAl9pWCI0cYXhDbR+pWP44tte0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4a3f2d3195b60d07530574988df92e049372c10e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -632,17 +646,17 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1694822471, - "narHash": "sha256-6fSDCj++lZVMZlyqOe9SIOL8tYSBz1bI8acwovRwoX8=", + "lastModified": 1729980323, + "narHash": "sha256-eWPRZAlhf446bKSmzw6x7RWEE4IuZgAp8NW3eXZwRAY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", + "rev": "86e78d3d2084ff87688da662cf78c2af085d8e73", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" } }, @@ -677,11 +691,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1715473225, - "narHash": "sha256-uAD2qephrnRmMdLiLNqbGXfgc0BGHveiHbRhm19cNs0=", + "lastModified": 1736899856, + "narHash": "sha256-1pmiaXI59iAfHOtTYU4hw7LdP7VVmyO9ZK5RG5F4Izc=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "207b7104d536df29d264047c37500a224dde97bc", + "rev": "c6a5d45df57c7669eb63e27ab4e8be212323d273", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 926e8b9..d0dc95e 100644 --- a/flake.nix +++ b/flake.nix @@ -3,33 +3,99 @@ inputs.haskellNix.url = "github:input-output-hk/haskell.nix"; inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.CHaP = { - url = "github:input-output-hk/cardano-haskell-packages?ref=repo"; + url = "github:IntersectMBO/cardano-haskell-packages?ref=repo"; flake = false; }; outputs = { self, nixpkgs, flake-utils, haskellNix, CHaP }: let supportedSystems = [ - "x86_64-linux" "x86_64-darwin" "aarch64-darwin" + "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; in flake-utils.lib.eachSystem supportedSystems (system: let + overlay = final: prev: { + haskell-nix = prev.haskell-nix // { + extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings // { + # String pkgconfig-depends names are mapped to lists of Nixpkgs package names + "libblst" = [ "blst" ]; + }; + }; + }; + overlays = [ haskellNix.overlay + (final: prev: { + webkitgtk = final.webkitgtk_4_0; + libsodium = with final; stdenv.mkDerivation rec { + pname = "libsodium"; + + src = fetchGit { + url = "https://github.com/IntersectMBO/libsodium"; + rev = version; + }; + version = "dbb48cce5429cb6585c9034f002568964f1ce567"; + + nativeBuildInputs = [ autoreconfHook ]; + + configureFlags = [ "--enable-static" ] + # Fixes a compilation failure: "undefined reference to `__memcpy_chk'". Note + # that the more natural approach of adding "stackprotector" to + # `hardeningDisable` does not resolve the issue. + ++ lib.optional stdenv.hostPlatform.isMinGW "CFLAGS=-fno-stack-protector"; + + outputs = [ "out" "dev" ]; + separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl"; + + enableParallelBuilding = true; + + doCheck = true; + + meta = with lib; { + description = "A modern and easy-to-use crypto library - VRF fork"; + homepage = "http://doc.libsodium.org/"; + license = licenses.isc; + maintainers = [ "tdammers" "nclarke" ]; + platforms = platforms.all; + }; + }; + }) (final: prev: { hixProject = - final.haskell-nix.hix.project { + final.haskell-nix.project' { src = ./.; - evalSystem = system; - inputMap = { "https://input-output-hk.github.io/cardano-haskell-packages" = CHaP; }; + compiler-nix-name = "ghc966"; + # 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 = {}; + fourmolu = {}; + }; + # Non-Haskell shell tools go here + shell.buildInputs = with final; [ + nixpkgs-fmt + ]; + # ???: Fix for `nix flake show --allow-import-from-derivation` + evalSystem = "x86_64-linux"; + inputMap = { "https://chap.intersectmbo.org/" = CHaP; }; + modules = with final; [{ + packages.postgresql-libpq-configure.components.library.libs = lib.mkForce [ [ postgresql ] ]; + }]; }; }) + overlay ]; pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; flake = pkgs.hixProject.flake {}; in flake // { legacyPackages = pkgs; + # Built by `nix build .` + # TODO: packages.default = flake.packages."geniusyield-market-maker:exe:geniusyield-market-maker-exe"; + packages = flake.packages // { + default = flake.packages."geniusyield-annset:test:geniusyield-annset-tests"; + }; }); # --- Flake Local Nix Configuration ---------------------------- nixConfig = { diff --git a/geniusyield-market-maker/geniusyield-market-maker.cabal b/geniusyield-market-maker/geniusyield-market-maker.cabal index 062d811..c257352 100644 --- a/geniusyield-market-maker/geniusyield-market-maker.cabal +++ b/geniusyield-market-maker/geniusyield-market-maker.cabal @@ -127,7 +127,7 @@ library geniusyield-market-maker-lib import: common-lang import: common-deps import: common-ghc-opts - hs-source-dirs: src + hs-source-dirs: src impl/datasource-providers impl/orderbook-annset test exposed-modules: GeniusYield.MarketMaker.Constants GeniusYield.MarketMaker.Equity @@ -201,4 +201,4 @@ test-suite pproviders-status-sequence , tasty , tasty-hunit mixins: - geniusyield-market-maker:orderbook-annset requires (GeniusYield.OrderBot.DataSource as GeniusYield.OrderBot.DataSource.Providers) \ No newline at end of file + geniusyield-market-maker:orderbook-annset requires (GeniusYield.OrderBot.DataSource as GeniusYield.OrderBot.DataSource.Providers) diff --git a/nix.md b/nix.md new file mode 100644 index 0000000..e2c31b7 --- /dev/null +++ b/nix.md @@ -0,0 +1,191 @@ +### Usage + +Investigate targets: + +```sh +nix flake show --allow-import-from-derivation +git+file:///home/netsu/Projects/market-maker +├───apps +│ ├───aarch64-darwin +│ │ ├───"geniusyield-annset:lib:geniusyield-annset": app +│ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": app +│ │ ├───"geniusyield-market-maker:exe:geniusyield-market-maker-exe": app +│ │ └───"geniusyield-market-maker:test:pproviders-status-sequence": app +│ ├───x86_64-darwin +│ │ ├───"geniusyield-annset:lib:geniusyield-annset": app +│ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": app +│ │ ├───"geniusyield-market-maker:exe:geniusyield-market-maker-exe": app +│ │ └───"geniusyield-market-maker:test:pproviders-status-sequence": app +│ └───x86_64-linux +│ ├───"geniusyield-annset:lib:geniusyield-annset": app +│ ├───"geniusyield-annset:test:geniusyield-annset-tests": app +│ ├───"geniusyield-market-maker:exe:geniusyield-market-maker-exe": app +│ └───"geniusyield-market-maker:test:pproviders-status-sequence": app +├───checks +│ ├───aarch64-darwin +│ │ ├───"geniusyield-annset:test:geniusyield-annset-tests" omitted (use '--all-systems' to show) +│ │ └───"geniusyield-market-maker:test:pproviders-status-sequence" omitted (use '--all-systems' to show) +│ ├───x86_64-darwin +│ │ ├───"geniusyield-annset:test:geniusyield-annset-tests" omitted (use '--all-systems' to show) +│ │ └───"geniusyield-market-maker:test:pproviders-status-sequence" omitted (use '--all-systems' to show) +│ └───x86_64-linux +│ ├───"geniusyield-annset:test:geniusyield-annset-tests": derivation 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0-check' +│ └───"geniusyield-market-maker:test:pproviders-status-sequence": derivation 'geniusyield-market-maker-test-pproviders-status-sequence-0.8.0-check' +├───ciJobs: unknown +├───devShell +│ ├───aarch64-darwin omitted (use '--all-systems' to show) +│ ├───x86_64-darwin omitted (use '--all-systems' to show) +│ └───x86_64-linux: development environment 'ghc-shell-for-packages' +├───devShells +│ ├───aarch64-darwin +│ │ └───default omitted (use '--all-systems' to show) +│ ├───x86_64-darwin +│ │ └───default omitted (use '--all-systems' to show) +│ └───x86_64-linux +│ └───default: development environment 'ghc-shell-for-packages' +├───hydraJobs +│ ├───aarch64-darwin +│ │ ├───checks +│ │ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": derivation 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0-check' +│ │ │ └───"geniusyield-market-maker:test:pproviders-status-sequence": derivation 'geniusyield-market-maker-test-pproviders-status-sequence-0.8.0-check' +│ │ ├───coverage +│ │ ├───devShells +│ │ │ └───default: derivation 'ghc-shell-for-packages' +│ │ ├───packages +│ │ │ ├───"geniusyield-annset:lib:geniusyield-annset": derivation 'geniusyield-annset-lib-geniusyield-annset-0.1.0.0' +│ │ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": derivation 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0' +│ │ │ ├───"geniusyield-market-maker:exe:geniusyield-market-maker-exe": derivation 'geniusyield-market-maker-exe-geniusyield-market-maker-exe-0.8.0' +│ │ │ ├───"geniusyield-market-maker:lib:datasource-providers": derivation 'geniusyield-market-maker-lib-datasource-providers-0.8.0' +│ │ │ ├───"geniusyield-market-maker:lib:geniusyield-market-maker-lib": derivation 'geniusyield-market-maker-lib-geniusyield-market-maker-lib-0.8.0' +│ │ │ ├───"geniusyield-market-maker:lib:orderbook-annset": derivation 'geniusyield-market-maker-lib-orderbook-annset-0.8.0' +│ │ │ ├───"geniusyield-market-maker:test:pproviders-status-sequence": derivation 'geniusyield-market-maker-test-pproviders-status-sequence-0.8.0' +│ │ │ ├───"geniusyield-orderbot-framework:lib:common": derivation 'geniusyield-orderbot-framework-lib-common-0.1.0.0' +│ │ │ ├───"geniusyield-orderbot-framework:lib:datasource": derivation 'geniusyield-orderbot-framework-lib-datasource-0.1.0.0' +│ │ │ └───"geniusyield-orderbot-framework:lib:orderbook": derivation 'geniusyield-orderbot-framework-lib-orderbook-0.1.0.0' +│ │ ├───plan-nix: derivation 'haskell-project-plan-to-nix-pkgs' +│ │ └───roots: derivation 'haskell-nix-roots-ghc966' +│ ├───x86_64-darwin +│ │ ├───checks +│ │ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": derivation 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0-check' +│ │ │ └───"geniusyield-market-maker:test:pproviders-status-sequence": derivation 'geniusyield-market-maker-test-pproviders-status-sequence-0.8.0-check' +│ │ ├───coverage +│ │ ├───devShells +│ │ │ └───default: derivation 'ghc-shell-for-packages' +│ │ ├───packages +│ │ │ ├───"geniusyield-annset:lib:geniusyield-annset": derivation 'geniusyield-annset-lib-geniusyield-annset-0.1.0.0' +│ │ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": derivation 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0' +│ │ │ ├───"geniusyield-market-maker:exe:geniusyield-market-maker-exe": derivation 'geniusyield-market-maker-exe-geniusyield-market-maker-exe-0.8.0' +│ │ │ ├───"geniusyield-market-maker:lib:datasource-providers": derivation 'geniusyield-market-maker-lib-datasource-providers-0.8.0' +│ │ │ ├───"geniusyield-market-maker:lib:geniusyield-market-maker-lib": derivation 'geniusyield-market-maker-lib-geniusyield-market-maker-lib-0.8.0' +│ │ │ ├───"geniusyield-market-maker:lib:orderbook-annset": derivation 'geniusyield-market-maker-lib-orderbook-annset-0.8.0' +│ │ │ ├───"geniusyield-market-maker:test:pproviders-status-sequence": derivation 'geniusyield-market-maker-test-pproviders-status-sequence-0.8.0' +│ │ │ ├───"geniusyield-orderbot-framework:lib:common": derivation 'geniusyield-orderbot-framework-lib-common-0.1.0.0' +│ │ │ ├───"geniusyield-orderbot-framework:lib:datasource": derivation 'geniusyield-orderbot-framework-lib-datasource-0.1.0.0' +│ │ │ └───"geniusyield-orderbot-framework:lib:orderbook": derivation 'geniusyield-orderbot-framework-lib-orderbook-0.1.0.0' +│ │ ├───plan-nix: derivation 'haskell-project-plan-to-nix-pkgs' +│ │ └───roots: derivation 'haskell-nix-roots-ghc966' +│ └───x86_64-linux +│ ├───checks +│ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": derivation 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0-check' +│ │ └───"geniusyield-market-maker:test:pproviders-status-sequence": derivation 'geniusyield-market-maker-test-pproviders-status-sequence-0.8.0-check' +│ ├───coverage +│ ├───devShells +│ │ └───default: derivation 'ghc-shell-for-packages' +│ ├───packages +│ │ ├───"geniusyield-annset:lib:geniusyield-annset": derivation 'geniusyield-annset-lib-geniusyield-annset-0.1.0.0' +│ │ ├───"geniusyield-annset:test:geniusyield-annset-tests": derivation 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0' +│ │ ├───"geniusyield-market-maker:exe:geniusyield-market-maker-exe": derivation 'geniusyield-market-maker-exe-geniusyield-market-maker-exe-0.8.0' +│ │ ├───"geniusyield-market-maker:lib:datasource-providers": derivation 'geniusyield-market-maker-lib-datasource-providers-0.8.0' +│ │ ├───"geniusyield-market-maker:lib:geniusyield-market-maker-lib": derivation 'geniusyield-market-maker-lib-geniusyield-market-maker-lib-0.8.0' +│ │ ├───"geniusyield-market-maker:lib:orderbook-annset": derivation 'geniusyield-market-maker-lib-orderbook-annset-0.8.0' +│ │ ├───"geniusyield-market-maker:test:pproviders-status-sequence": derivation 'geniusyield-market-maker-test-pproviders-status-sequence-0.8.0' +│ │ ├───"geniusyield-orderbot-framework:lib:common": derivation 'geniusyield-orderbot-framework-lib-common-0.1.0.0' +│ │ ├───"geniusyield-orderbot-framework:lib:datasource": derivation 'geniusyield-orderbot-framework-lib-datasource-0.1.0.0' +│ │ └───"geniusyield-orderbot-framework:lib:orderbook": derivation 'geniusyield-orderbot-framework-lib-orderbook-0.1.0.0' +│ ├───plan-nix: derivation 'haskell-project-plan-to-nix-pkgs' +│ └───roots: derivation 'haskell-nix-roots-ghc966' +├───legacyPackages +│ ├───aarch64-darwin omitted (use '--legacy' to show) +│ ├───x86_64-darwin omitted (use '--legacy' to show) +│ └───x86_64-linux omitted (use '--legacy' to show) +└───packages + ├───aarch64-darwin + │ └───default omitted (use '--all-systems' to show) + ├───x86_64-darwin + │ └───default omitted (use '--all-systems' to show) + └───x86_64-linux + └───default: package 'geniusyield-annset-test-geniusyield-annset-tests-0.1.0.0' +``` + +To open shell: + +```sh +nix develop +``` + +It supposed to be that in the shell the `cabal update` should be not necessary! +But at the moment, there's a bug: https://github.com/IntersectMBO/cardano-cli/issues/533#issuecomment-2014821037 + +```sh +cabal update +cabal build all +``` + +To build: + + +```sh +nix build . +``` + +### Known limitations + +- some birary caches are not useful now, because of fixes of dependencies, so each cabal update leads to the massive recompilation ☹️ +- cross-compilation possible but not implemented (yet) +- cabal inside the shell rebuild available haskell packages + +Feel free to add any useful run scripts to the flake, please! + +### Troubleshooting + +Check cabal file: + +```sh +nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/041c867bad68dfe34b78b2813028a2e2ea70a23c.tar.gz -p haskellPackages.cabal-install haskellPackages.ghc --run "cabal new-configure" +``` + +Check build: + +```sh +nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/041c867bad68dfe34b78b2813028a2e2ea70a23c.tar.gz -p haskellPackages.cabal-install -p libsodium -p blst -p secp256k1 -p zlib -p postgresql -p pkg-config haskellPackages.ghc --run "cabal build all" +``` + +Check cabal2nix: + +```sh +nix build -f https://github.com/input-output-hk/haskell.nix/archive/94a061666cbd39c32468efed72dca29cf716c90a.tar.gz pkgs.haskell-nix.nix-tools.ghc966 --out-link nt +``` + +Elaborate derivation: + +```sh +nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/041c867bad68dfe34b78b2813028a2e2ea70a23c.tar.gz -p nix-prefetch-git --run "./nt/bin/plan-to-nix --output ./. --plan-json ./dist-newstyle/cache/plan.json --cabal-project geniusyield-market-maker/geniusyield-market-maker.cabal" +``` + +Investigate inputs: + +```sh +nix --extra-experimental-features repl-flake repl . +> packages.x86_64-linux.geniusyield- +packages.x86_64-linux.geniusyield-annset:lib:geniusyield-annset packages.x86_64-linux.geniusyield-market-maker:test:pproviders-status-sequence +packages.x86_64-linux.geniusyield-annset:test:geniusyield-annset-tests packages.x86_64-linux.geniusyield-orderbot-framework:lib:common +packages.x86_64-linux.geniusyield-market-maker:exe:geniusyield-market-maker-exe packages.x86_64-linux.geniusyield-orderbot-framework:lib:datasource +packages.x86_64-linux.geniusyield-market-maker:lib:datasource-providers packages.x86_64-linux.geniusyield-orderbot-framework:lib:orderbook +packages.x86_64-linux.geniusyield-market-maker:lib:geniusyield-market-maker-lib +packages.x86_64-linux.geniusyield-market-maker:lib:orderbook-annset +``` + + + + + diff --git a/nix/hix.nix b/nix/hix.nix deleted file mode 100644 index ded70bc..0000000 --- a/nix/hix.nix +++ /dev/null @@ -1,25 +0,0 @@ -{pkgs, config, ...}: { - # name = "project-name"; - compiler-nix-name = "ghc928"; # Version of GHC to use - - # Cross compilation support: - # crossPlatforms = p: pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86_64 ([ - # p.mingwW64 - # p.ghcjs - # ] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [ - # p.musl64 - # ]); - - # Tools to include in the development shell - shell = { - tools = { - cabal = "3.10.1.0"; - hlint = "3.6.1"; - haskell-language-server = { version = "2.0.0.0"; index-state = "2023-06-05T06:39:32Z"; }; - }; - - buildInputs = with pkgs; [ - jq - ]; - }; -}