diff --git a/.gitignore b/.gitignore index cde4093e..462c7c74 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ haddocks/ .envrc get-protocol-parameters.sh protocol-parameters-mainnet.json +.pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 120000 index 758affe7..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1 +0,0 @@ -/nix/store/3byva98dv9ps7yx41q8yc0a44dysrqi4-pre-commit-config.json \ No newline at end of file diff --git a/flake.lock b/flake.lock index 6f254151..e1fcdba0 100644 --- a/flake.lock +++ b/flake.lock @@ -3,15 +3,15 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1730295876, - "narHash": "sha256-ijnHTQ6eKIQ9FpEqDKt6c7vuFYN8aOBDhonp67utx2s=", - "owner": "intersectmbo", + "lastModified": 1733408643, + "narHash": "sha256-IH5nYTjx+CYAK4zQAkOs475X+AOhP/GPgwXm5LQHsEE=", + "owner": "IntersectMBO", "repo": "cardano-haskell-packages", - "rev": "25591f43ab943d5a070db5e8a2b9ff3a499d4d92", + "rev": "e062328804c933d296e5956c989b326ea3c69eeb", "type": "github" }, "original": { - "owner": "intersectmbo", + "owner": "IntersectMBO", "ref": "repo", "repo": "cardano-haskell-packages", "type": "github" @@ -475,6 +475,24 @@ "type": "github" } }, + "easy-purescript-nix": { + "inputs": { + "flake-utils": "flake-utils_5" + }, + "locked": { + "lastModified": 1710161569, + "narHash": "sha256-lcIRIOFCdIWEGyKyG/tB4KvxM9zoWuBRDxW+T+mvIb0=", + "owner": "justinwoo", + "repo": "easy-purescript-nix", + "rev": "117fd96acb69d7d1727df95b6fde9d8715e031fc", + "type": "github" + }, + "original": { + "owner": "justinwoo", + "repo": "easy-purescript-nix", + "type": "github" + } + }, "em": { "flake": false, "locked": { @@ -573,21 +591,34 @@ "type": "github" } }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "flake-compat_5": { + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_6": { + "flake": false, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, @@ -651,6 +682,60 @@ "type": "github" } }, + "flake-utils_5": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_7": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "ghc-8.6.5-iohk": { "flake": false, "locked": { @@ -722,6 +807,28 @@ "url": "https://gitlab.haskell.org/ghc/ghc" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "iogx", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "gomod2nix": { "inputs": { "nixpkgs": "nixpkgs", @@ -773,6 +880,61 @@ "type": "github" } }, + "haskell-nix": { + "inputs": { + "HTTP": "HTTP_2", + "cabal-32": "cabal-32_2", + "cabal-34": "cabal-34_2", + "cabal-36": "cabal-36_2", + "cardano-shell": "cardano-shell_2", + "flake-compat": "flake-compat_4", + "ghc-8.6.5-iohk": "ghc-8.6.5-iohk_2", + "hackage": [ + "hackage" + ], + "hls-1.10": "hls-1.10_2", + "hls-2.0": "hls-2.0_2", + "hls-2.2": "hls-2.2_2", + "hls-2.3": "hls-2.3_2", + "hls-2.4": "hls-2.4_2", + "hls-2.5": "hls-2.5_2", + "hls-2.6": "hls-2.6_2", + "hls-2.7": "hls-2.7_2", + "hls-2.8": "hls-2.8_2", + "hls-2.9": "hls-2.9", + "hpc-coveralls": "hpc-coveralls_2", + "hydra": "hydra_2", + "iserv-proxy": "iserv-proxy_2", + "nixpkgs": [ + "haskell-nix", + "nixpkgs-unstable" + ], + "nixpkgs-2003": "nixpkgs-2003_2", + "nixpkgs-2105": "nixpkgs-2105_2", + "nixpkgs-2111": "nixpkgs-2111_2", + "nixpkgs-2205": "nixpkgs-2205_2", + "nixpkgs-2211": "nixpkgs-2211_2", + "nixpkgs-2305": "nixpkgs-2305_2", + "nixpkgs-2311": "nixpkgs-2311_2", + "nixpkgs-2405": "nixpkgs-2405", + "nixpkgs-unstable": "nixpkgs-unstable_2", + "old-ghc-nix": "old-ghc-nix_2", + "stackage": "stackage_2" + }, + "locked": { + "lastModified": 1733791914, + "narHash": "sha256-vauQWCKtR7r4UBOmdXyIVAa19Ct7O8MSxI8ZNSmxDMs=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "ed1653d026dd24f4905a57c10dc2b7d0859eafda", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, "haskellNix": { "inputs": { "HTTP": "HTTP", @@ -830,61 +992,6 @@ "type": "github" } }, - "haskellNix_2": { - "inputs": { - "HTTP": "HTTP_2", - "cabal-32": "cabal-32_2", - "cabal-34": "cabal-34_2", - "cabal-36": "cabal-36_2", - "cardano-shell": "cardano-shell_2", - "flake-compat": "flake-compat_4", - "ghc-8.6.5-iohk": "ghc-8.6.5-iohk_2", - "hackage": [ - "hackage" - ], - "hls-1.10": "hls-1.10_2", - "hls-2.0": "hls-2.0_2", - "hls-2.2": "hls-2.2_2", - "hls-2.3": "hls-2.3_2", - "hls-2.4": "hls-2.4_2", - "hls-2.5": "hls-2.5_2", - "hls-2.6": "hls-2.6_2", - "hls-2.7": "hls-2.7_2", - "hls-2.8": "hls-2.8_2", - "hls-2.9": "hls-2.9", - "hpc-coveralls": "hpc-coveralls_2", - "hydra": "hydra_2", - "iserv-proxy": "iserv-proxy_2", - "nixpkgs": [ - "haskellNix", - "nixpkgs-unstable" - ], - "nixpkgs-2003": "nixpkgs-2003_2", - "nixpkgs-2105": "nixpkgs-2105_2", - "nixpkgs-2111": "nixpkgs-2111_2", - "nixpkgs-2205": "nixpkgs-2205_2", - "nixpkgs-2211": "nixpkgs-2211_2", - "nixpkgs-2305": "nixpkgs-2305_2", - "nixpkgs-2311": "nixpkgs-2311_2", - "nixpkgs-2405": "nixpkgs-2405", - "nixpkgs-unstable": "nixpkgs-unstable_2", - "old-ghc-nix": "old-ghc-nix_2", - "stackage": "stackage_2" - }, - "locked": { - "lastModified": 1730681472, - "narHash": "sha256-Dj7VqPI2Y5sGNQoe/TB6AVjzU5GcHswD7HA0QtxAzhQ=", - "owner": "input-output-hk", - "repo": "haskell.nix", - "rev": "ff2349914ccdc5f2ec04bd3e96967da142176e9f", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "haskell.nix", - "type": "github" - } - }, "haumea": { "inputs": { "nixpkgs": [ @@ -1291,7 +1398,7 @@ "inputs": { "nix": "nix_2", "nixpkgs": [ - "haskellNix", + "haskell-nix", "hydra", "nix", "nixpkgs" @@ -1332,19 +1439,59 @@ "type": "github" } }, + "iogx": { + "inputs": { + "CHaP": [ + "CHaP" + ], + "easy-purescript-nix": "easy-purescript-nix", + "flake-compat": "flake-compat_5", + "flake-utils": "flake-utils_6", + "hackage": [ + "hackage" + ], + "haskell-nix": [ + "haskell-nix" + ], + "iohk-nix": "iohk-nix", + "nix2container": "nix2container_2", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "sphinxcontrib-haddock": "sphinxcontrib-haddock" + }, + "locked": { + "lastModified": 1733738060, + "narHash": "sha256-uZZB/JE7ED7QWfsj9UOQriu3E5kDCtgWMvLCVujnqAo=", + "owner": "input-output-hk", + "repo": "iogx", + "rev": "507209c0acf0aaf607626d73b1711ea0afde7108", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "iogx", + "type": "github" + } + }, "iohk-nix": { "inputs": { "blst": "blst_2", - "nixpkgs": "nixpkgs_8", + "nixpkgs": [ + "iogx", + "nixpkgs" + ], "secp256k1": "secp256k1_2", "sodium": "sodium_2" }, "locked": { - "lastModified": 1730297014, - "narHash": "sha256-n3f1iAmltKnorHWx7FrdbGIF/FmEG8SsZshS16vnpz0=", + "lastModified": 1732287300, + "narHash": "sha256-lURsE6HdJX0alscWhbzCWyLRK8GpAgKuXeIgX31Kfqg=", "owner": "input-output-hk", "repo": "iohk-nix", - "rev": "d407eedd4995e88d08e83ef75844a8a9c2e29b36", + "rev": "262cb2aec2ddd914124bab90b06fe24a1a74d02c", "type": "github" }, "original": { @@ -1577,6 +1724,25 @@ "type": "github" } }, + "nix2container_2": { + "inputs": { + "flake-utils": "flake-utils_7", + "nixpkgs": "nixpkgs_8" + }, + "locked": { + "lastModified": 1730479402, + "narHash": "sha256-79NLeNjpCa4mSasmFsE3QA6obURezF0TUO5Pm+1daog=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "5fb215a1564baa74ce04ad7f903d94ad6617e17a", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, "nix_2": { "inputs": { "lowdown-src": "lowdown-src_2", @@ -1878,11 +2044,11 @@ }, "nixpkgs-2405": { "locked": { - "lastModified": 1726447378, - "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "lastModified": 1729242558, + "narHash": "sha256-VgcLDu4igNT0eYua6OAl9pWCI0cYXhDbR+pWP44tte0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "rev": "4a3f2d3195b60d07530574988df92e049372c10e", "type": "github" }, "original": { @@ -1892,18 +2058,6 @@ "type": "github" } }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1730504152, - "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" - } - }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -1936,6 +2090,38 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1690680713, + "narHash": "sha256-NXCWA8N+GfSQyoN7ZNiOgq/nDJKOp5/BHEpiZP8sUZw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b81af66deb21f73a70c67e5ea189568af53b1e8c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b81af66deb21f73a70c67e5ea189568af53b1e8c", + "type": "github" + } + }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1694822471, @@ -1954,11 +2140,11 @@ }, "nixpkgs-unstable_2": { "locked": { - "lastModified": 1726583932, - "narHash": "sha256-zACxiQx8knB3F8+Ze+1BpiYrI+CbhxyWpcSID9kVhkQ=", + "lastModified": 1729980323, + "narHash": "sha256-eWPRZAlhf446bKSmzw6x7RWEE4IuZgAp8NW3eXZwRAY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "658e7223191d2598641d50ee4e898126768fe847", + "rev": "86e78d3d2084ff87688da662cf78c2af085d8e73", "type": "github" }, "original": { @@ -2063,16 +2249,31 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1684171562, - "narHash": "sha256-BMUWjVWAUdyMWKk0ATMC9H0Bv4qAV/TXwwPUvTiC5IQ=", - "owner": "nixos", + "lastModified": 1712920918, + "narHash": "sha256-1yxFvUcJfUphK9V91KufIQom7gCsztza0H4Rz2VCWUU=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "55af203d468a6f5032a519cba4f41acf5a74b638", + "rev": "92323443a56f4e9fc4e4b712e3119f66d0969297", "type": "github" }, "original": { - "owner": "nixos", - "ref": "release-22.11", + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_9": { + "locked": { + "lastModified": 1730768919, + "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -2189,17 +2390,37 @@ "type": "github" } }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat_6", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_9", + "nixpkgs-stable": "nixpkgs-stable_2" + }, + "locked": { + "lastModified": 1733318908, + "narHash": "sha256-SVQVsbafSM1dJ4fpgyBqLZ+Lft+jcQuMtEL3lQWx2Sk=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "6f4e2a2112050951a314d2733a994fbab94864c6", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "CHaP": "CHaP", "cardano-node": "cardano-node", - "flake-parts": "flake-parts", "hackage": "hackage", - "haskellNix": "haskellNix_2", - "iohk-nix": "iohk-nix", + "haskell-nix": "haskell-nix", + "iogx": "iogx", "nixpkgs": [ - "haskellNix", - "nixpkgs-unstable" + "haskell-nix", + "nixpkgs" ] } }, @@ -2271,6 +2492,22 @@ "type": "github" } }, + "sphinxcontrib-haddock": { + "flake": false, + "locked": { + "lastModified": 1594136664, + "narHash": "sha256-O9YT3iCUBHP3CEF88VDLLCO2HSP3HqkNA2q2939RnVY=", + "owner": "michaelpj", + "repo": "sphinxcontrib-haddock", + "rev": "f3956b3256962b2d27d5a4e96edb7951acf5de34", + "type": "github" + }, + "original": { + "owner": "michaelpj", + "repo": "sphinxcontrib-haddock", + "type": "github" + } + }, "stackage": { "flake": false, "locked": { @@ -2290,11 +2527,11 @@ "stackage_2": { "flake": false, "locked": { - "lastModified": 1730679100, - "narHash": "sha256-iPXuh2rG9wd01CyZX85MdCDuZKt/+sorJ/q/8EcQdvc=", + "lastModified": 1733789551, + "narHash": "sha256-0tSxhYw3RqNEHYFYIwJZ99mFDpGr8Dekf+p2ZCEygYY=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "e78d11489de1835924f10352dc212c8df0c5e640", + "rev": "db7b3e7ae59867ce0ba21df45f57ea38f57710ab", "type": "github" }, "original": { @@ -2419,6 +2656,51 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tullia": { "inputs": { "nix-nomad": "nix-nomad", diff --git a/flake.nix b/flake.nix index 278826cf..10e42cd1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,74 +1,45 @@ { description = "sc-tools"; + inputs = { - flake-parts.url = "github:hercules-ci/flake-parts"; - nixpkgs.follows = "haskellNix/nixpkgs-unstable"; + iogx = { + url = "github:input-output-hk/iogx"; + inputs.hackage.follows = "hackage"; + inputs.CHaP.follows = "CHaP"; + inputs.haskell-nix.follows = "haskell-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixpkgs.follows = "haskell-nix/nixpkgs"; + hackage = { url = "github:input-output-hk/hackage.nix"; flake = false; }; + CHaP = { - url = "github:intersectmbo/cardano-haskell-packages?ref=repo"; + url = "github:IntersectMBO/cardano-haskell-packages?ref=repo"; flake = false; }; - haskellNix = { + + haskell-nix = { url = "github:input-output-hk/haskell.nix"; inputs.hackage.follows = "hackage"; }; - iohk-nix.url = "github:input-output-hk/iohk-nix"; + cardano-node = { url = "github:input-output-hk/cardano-node?ref=10.1.1"; }; }; - outputs = inputs@{ nixpkgs, haskellNix, flake-parts, CHaP, iohk-nix, cardano-node, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" ]; - perSystem = { self', system, lib, config, pkgs, ... }: - let - overlays = [ - haskellNix.overlay - iohk-nix.overlays.crypto - iohk-nix.overlays.haskell-nix-crypto - (final: prev: { - sc-tools = final.haskell-nix.cabalProject' { - compiler-nix-name = "ghc966"; - src = lib.cleanSource ./.; - shell = { - # Disabled this due to a build failure in http-client-tls - # See https://github.com/snoyberg/http-client/issues/548 - # TODO: set to 'true' when the issue has been fixed. - withHoogle = false; - buildInputs = with pkgs; [ - cardano-node.packages.${system}.cardano-node - fd - ]; - tools = { - cabal = "latest"; - haskell-language-server = "latest"; - ghcide = "latest"; - ghcid = "latest"; - stylish-haskell = "latest"; - }; - }; - inputMap = { "https://chap.intersectmbo.org/" = CHaP; }; - }; - }) - ]; - pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; - flake = pkgs.sc-tools.flake { }; - in - { - devShells = flake.devShells; - packages = flake.packages; - checks = { - build-all = pkgs.runCommandCC "check all cabal.project pagackes" - { - buildInputs = builtins.attrValues flake.packages; - } - "mkdir $out"; - }; - }; - }; + + + outputs = inputs: inputs.iogx.lib.mkFlake { + inherit inputs; + repoRoot = ./.; + outputs = import ./nix/outputs.nix; + systems = [ "x86_64-linux" ]; + }; + nixConfig = { extra-substituters = [ "https://cache.iog.io" diff --git a/nix/outputs.nix b/nix/outputs.nix new file mode 100644 index 00000000..d03531a2 --- /dev/null +++ b/nix/outputs.nix @@ -0,0 +1,12 @@ +{ repoRoot, inputs, pkgs, lib, system }: +let + project = repoRoot.nix.project; +in +[ + ( + project.flake + ) + { + devShells.profiled = project.variants.profiled.devShells.default; + } +] diff --git a/nix/project.nix b/nix/project.nix new file mode 100644 index 00000000..ff3ba8f7 --- /dev/null +++ b/nix/project.nix @@ -0,0 +1,37 @@ +{ repoRoot, inputs, pkgs, lib, system }: + +let + sha256map = { + }; + + modules = [ + ({ config, ... }: { + packages = { + # TODO + # convex-base.ghcOptions = [ "-Werror" ]; + # convex-coin-selection.ghcOptions = [ "-Werror" ]; + }; + }) + ]; + + cabalProject = pkgs.haskell-nix.cabalProject' { + inherit modules sha256map; + src = ../.; + name = "sc-tools"; + compiler-nix-name = "ghc966"; + inputMap = { "https://chap.intersectmbo.org/" = inputs.CHaP; }; + shell.withHoogle = false; + flake.variants.profiled = { + modules = [{ enableProfiling = true; enableLibraryProfiling = true; profilingDetail = "none"; }]; + }; + }; + + + project = lib.iogx.mkHaskellProject { + inherit cabalProject; + shellArgs = repoRoot.nix.shell; + }; + +in + +project diff --git a/nix/shell.nix b/nix/shell.nix new file mode 100644 index 00000000..acb00cb1 --- /dev/null +++ b/nix/shell.nix @@ -0,0 +1,28 @@ +{ repoRoot, inputs, pkgs, lib, system }: + +cabalProject: + +let + cardano-node = inputs.cardano-node.packages.cardano-node; +in +{ + name = "stablecoin-plutus"; + packages = [ + cardano-node + ]; + + env = { + CARDANO_NODE = "${cardano-node}/bin/cardano-node"; + }; + + preCommit = { + # NOTE: when this attribute set changes, `.pre-commit-config.yaml` (which is a sym link to the nix store) changes. + # To maintain a the same hooks for both nix and non-nix environment you should update the `.pre-commit-config.yaml.nonix` + # (`cp .pre-commit-config.yaml .pre-commit-config.yaml.nonix`). + # This step is necessary because `.pre-commit-config.yaml` is ignored by git. + # TODO To enable in a future PR + # cabal-fmt.enable = true; + stylish-haskell.enable = true; + # nixpkgs-fmt.enable = true; + }; +}