From 12530172536269c23b3cac4a71eb81fd352b0dde Mon Sep 17 00:00:00 2001 From: ThetaSinner Date: Fri, 12 Jul 2024 14:56:36 +0100 Subject: [PATCH] Use new Holonix at 0.4 --- flake.lock | 516 +++++++++++--------------------------- flake.nix | 120 +++++---- nix/modules/formatter.nix | 7 +- nix/modules/happs.nix | 339 +++++++++++++------------ nix/modules/rust.nix | 43 ++-- nix/modules/scenario.nix | 92 ++++--- nix/modules/scenarios.nix | 32 ++- nix/modules/workspace.nix | 120 +++++---- nix/modules/zome.nix | 44 ++-- nix/modules/zomes.nix | 18 +- 10 files changed, 544 insertions(+), 787 deletions(-) diff --git a/flake.lock b/flake.lock index 14d99e31..0dc20af2 100644 --- a/flake.lock +++ b/flake.lock @@ -4,17 +4,17 @@ "inputs": { "naersk": "naersk", "nixpkgs": [ - "holochain", + "holonix", "nixpkgs" ], "utils": "utils" }, "locked": { - "lastModified": 1720515076, - "narHash": "sha256-DRghB5nXdXzyMLoo3zI8oYTfhaF0nxWJdmdH7vo4wLo=", + "lastModified": 1720711731, + "narHash": "sha256-e3UmwyA8TUVqQytF7K58lO3j8MsoH3hoA4n4YBhGDoM=", "owner": "Ph0enixKM", "repo": "Amber", - "rev": "a0bbc045abfca7c782bddbb6a945e3e2c0643d5c", + "rev": "58e9d04d85d5195c97e88e9413dc76b3fa0f83fd", "type": "github" }, "original": { @@ -40,23 +40,6 @@ "type": "github" } }, - "cargo-chef_2": { - "flake": false, - "locked": { - "lastModified": 1695999026, - "narHash": "sha256-UtLoZd7YBRSF9uXStfC3geEFqSqZXFh1rLHaP8hre0Y=", - "owner": "LukeMathWalker", - "repo": "cargo-chef", - "rev": "6e96ae5cd023b718ae40d608981e50a6e7d7facf", - "type": "github" - }, - "original": { - "owner": "LukeMathWalker", - "ref": "main", - "repo": "cargo-chef", - "type": "github" - } - }, "cargo-rdme": { "flake": false, "locked": { @@ -74,36 +57,19 @@ "type": "github" } }, - "cargo-rdme_2": { - "flake": false, - "locked": { - "lastModified": 1675118998, - "narHash": "sha256-lrYWqu3h88fr8gG3Yo5GbFGYaq5/1Os7UtM+Af0Bg4k=", - "owner": "orium", - "repo": "cargo-rdme", - "rev": "f9dbb6bccc078f4869f45ae270a2890ac9a75877", - "type": "github" - }, - "original": { - "owner": "orium", - "ref": "v1.1.0", - "repo": "cargo-rdme", - "type": "github" - } - }, "crane": { "inputs": { "nixpkgs": [ - "holochain", + "holonix", "nixpkgs" ] }, "locked": { - "lastModified": 1720226507, - "narHash": "sha256-yHVvNsgrpyNTXZBEokL8uyB2J6gB1wEx0KOJzoeZi1A=", + "lastModified": 1720546058, + "narHash": "sha256-iU2yVaPIZm5vMGdlT0+57vdB/aPq/V5oZFBRwYw+HBM=", "owner": "ipetkov", "repo": "crane", - "rev": "0aed560c5c0a61c9385bddff471a13036203e11c", + "rev": "2d83156f23c43598cf44e152c33a59d3892f8b29", "type": "github" }, "original": { @@ -113,27 +79,6 @@ } }, "crane_2": { - "inputs": { - "nixpkgs": [ - "holochain", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1707363936, - "narHash": "sha256-QbqyvGFYt84QNOQLOOTWplZZkzkyDhYrAl/N/9H0vFM=", - "owner": "ipetkov", - "repo": "crane", - "rev": "9107434eda6991e9388ad87b815dafa337446d16", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "crane_3": { "inputs": { "nixpkgs": [ "tryorama", @@ -154,7 +99,7 @@ "type": "github" } }, - "crane_4": { + "crane_3": { "inputs": { "nixpkgs": [ "tryorama", @@ -192,22 +137,6 @@ "type": "github" } }, - "crate2nix_2": { - "flake": false, - "locked": { - "lastModified": 1706909251, - "narHash": "sha256-T7G9Uhh77P0kKri/u+Mwa/4YnXwdPsJSwYCiJCCW+fs=", - "owner": "kolloch", - "repo": "crate2nix", - "rev": "15656bb6cb15f55ee3344bf4362e6489feb93db6", - "type": "github" - }, - "original": { - "owner": "kolloch", - "repo": "crate2nix", - "type": "github" - } - }, "empty": { "flake": false, "locked": { @@ -224,22 +153,6 @@ "type": "github" } }, - "empty_2": { - "flake": false, - "locked": { - "lastModified": 1683792623, - "narHash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=", - "owner": "steveej", - "repo": "empty", - "rev": "8e328e450e4cd32e072eba9e99fe92cf2a1ef5cf", - "type": "github" - }, - "original": { - "owner": "steveej", - "repo": "empty", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -256,37 +169,22 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1706830856, - "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", "type": "github" }, "original": { - "id": "flake-parts", - "type": "indirect" + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" } }, "flake-parts_2": { @@ -311,11 +209,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -342,68 +240,53 @@ "type": "github" } }, - "flake-utils_3": { - "inputs": { - "systems": "systems_4" + "hc-launch": { + "flake": false, + "locked": { + "lastModified": 1715106263, + "narHash": "sha256-a7iQ8pKGz6fghJrtXq0Xamp57GE8Hd3w5YQASzz5Wlk=", + "owner": "holochain", + "repo": "launcher", + "rev": "92bd39e1c66912d61c35c4725d7b106959888670", + "type": "github" }, + "original": { + "owner": "holochain", + "ref": "holochain-weekly", + "repo": "launcher", + "type": "github" + } + }, + "hc-scaffold": { + "flake": false, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "lastModified": 1720709716, + "narHash": "sha256-JrUNDbAiSPl11L8JxtgNfKXV13bWgCD+Xd0hNy8nK9A=", + "owner": "holochain", + "repo": "scaffolding", + "rev": "3241aaaf52589ced9e29bf616407b867f6927c44", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "holochain", + "ref": "holochain-weekly", + "repo": "scaffolding", "type": "github" } }, "holochain": { - "inputs": { - "cargo-chef": "cargo-chef", - "cargo-rdme": "cargo-rdme", - "crane": "crane_2", - "crate2nix": "crate2nix", - "empty": "empty", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "holochain": [ - "holochain", - "empty" - ], - "lair": [ - "holochain", - "empty" - ], - "launcher": [ - "holochain", - "empty" - ], - "nix-filter": "nix-filter", - "nixpkgs": "nixpkgs_2", - "pre-commit-hooks-nix": "pre-commit-hooks-nix", - "repo-git": "repo-git", - "rust-overlay": "rust-overlay", - "scaffolding": [ - "holochain", - "empty" - ], - "versions": [ - "versions" - ] - }, + "flake": false, "locked": { - "lastModified": 1720481908, - "narHash": "sha256-UjKicjEFFZ/QtqqDEFDMeLyE7nC9by/2KYbXBVshqMA=", + "lastModified": 1720573775, + "narHash": "sha256-ElKLtMDQpK+4NJixEz0SerENGgle88vp3GPePoOkCPQ=", "owner": "holochain", "repo": "holochain", - "rev": "c30873ff7de7cb7234c973aeae3672507350870d", + "rev": "e7c08520293e17501637f3d36841b1e5c7802603", "type": "github" }, "original": { "owner": "holochain", + "ref": "holochain-0.4.0-dev.12", "repo": "holochain", "type": "github" } @@ -411,45 +294,54 @@ "holochain_2": { "flake": false, "locked": { - "lastModified": 1718142789, - "narHash": "sha256-Lam1hWLqi+zv0umdTIIHK9YKHVWQrI/Z4AySo97xK9E=", + "lastModified": 1718154411, + "narHash": "sha256-jlFRYa8ikBYunTPOV7lngEiuq3ULM8u9yITsuKUf/7o=", "owner": "holochain", "repo": "holochain", - "rev": "582f05b66b690448b1574d1aa6004114ff98187f", + "rev": "db897af50d3fb25e819c05096f2cb5df3603fd75", "type": "github" }, "original": { "owner": "holochain", - "ref": "holochain-0.3.1", + "ref": "holochain-0.4.0-dev.8", "repo": "holochain", "type": "github" } }, - "holochain_3": { - "flake": false, + "holonix": { + "inputs": { + "crane": "crane", + "flake-parts": "flake-parts", + "hc-launch": "hc-launch", + "hc-scaffold": "hc-scaffold", + "holochain": "holochain", + "lair-keystore": "lair-keystore", + "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay" + }, "locked": { - "lastModified": 1718142789, - "narHash": "sha256-Lam1hWLqi+zv0umdTIIHK9YKHVWQrI/Z4AySo97xK9E=", + "lastModified": 1720726548, + "narHash": "sha256-Rp6Ks+GA82/xDzfrJwGVr7xuOACeHsPC3CR1sGpWaiM=", "owner": "holochain", - "repo": "holochain", - "rev": "582f05b66b690448b1574d1aa6004114ff98187f", + "repo": "holonix", + "rev": "63cdd16daf92ad3fd342b56ce23d88f93cc7fc68", "type": "github" }, "original": { "owner": "holochain", - "ref": "holochain-0.3.1", - "repo": "holochain", + "ref": "main", + "repo": "holonix", "type": "github" } }, - "holonix": { + "holonix_2": { "inputs": { - "cargo-chef": "cargo-chef_2", - "cargo-rdme": "cargo-rdme_2", - "crane": "crane_4", - "crate2nix": "crate2nix_2", - "empty": "empty_2", - "flake-compat": "flake-compat_2", + "cargo-chef": "cargo-chef", + "cargo-rdme": "cargo-rdme", + "crane": "crane_3", + "crate2nix": "crate2nix", + "empty": "empty", + "flake-compat": "flake-compat", "flake-parts": "flake-parts_2", "holochain": [ "tryorama", @@ -466,10 +358,10 @@ "holonix", "empty" ], - "nix-filter": "nix-filter_2", + "nix-filter": "nix-filter", "nixpkgs": "nixpkgs_3", - "pre-commit-hooks-nix": "pre-commit-hooks-nix_2", - "repo-git": "repo-git_2", + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "repo-git": "repo-git", "rust-overlay": "rust-overlay_3", "scaffolding": [ "tryorama", @@ -482,11 +374,11 @@ ] }, "locked": { - "lastModified": 1718285062, - "narHash": "sha256-FVXY8scfrt2QQ1v3iqAK8GTaMmSOClNFlI0/T+qZeTU=", + "lastModified": 1718224007, + "narHash": "sha256-uPOaySGH58H9hQS8fM/TfyYl2tIU9B7p6OcYlVPnuoY=", "owner": "holochain", "repo": "holochain", - "rev": "4be2cfa4aa5d92dcea35f76aff344af5127e07fb", + "rev": "649ad4c97ecb0bb113139d1aff688b689853b292", "type": "github" }, "original": { @@ -498,33 +390,33 @@ "lair": { "flake": false, "locked": { - "lastModified": 1709335027, - "narHash": "sha256-rKMhh7TLuR1lqze2YFWZCGYKZQoB4dZxjpX3sb7r7Jk=", + "lastModified": 1717684904, + "narHash": "sha256-vcXt67Tl1qwVUkx8CBevdQocqZXUEeoXjaYw86ljsYo=", "owner": "holochain", "repo": "lair", - "rev": "826be915efc839d1d1b8a2156b158999b8de8d5b", + "rev": "6a84ed490fc7074d107e38bbb4a8d707e9b8e066", "type": "github" }, "original": { "owner": "holochain", - "ref": "lair_keystore-v0.4.4", + "ref": "lair_keystore-v0.4.5", "repo": "lair", "type": "github" } }, - "lair_2": { + "lair-keystore": { "flake": false, "locked": { - "lastModified": 1709335027, - "narHash": "sha256-rKMhh7TLuR1lqze2YFWZCGYKZQoB4dZxjpX3sb7r7Jk=", + "lastModified": 1717684904, + "narHash": "sha256-vcXt67Tl1qwVUkx8CBevdQocqZXUEeoXjaYw86ljsYo=", "owner": "holochain", "repo": "lair", - "rev": "826be915efc839d1d1b8a2156b158999b8de8d5b", + "rev": "6a84ed490fc7074d107e38bbb4a8d707e9b8e066", "type": "github" }, "original": { "owner": "holochain", - "ref": "lair_keystore-v0.4.4", + "ref": "lair_keystore-v0.4.5", "repo": "lair", "type": "github" } @@ -532,33 +424,16 @@ "launcher": { "flake": false, "locked": { - "lastModified": 1717431387, - "narHash": "sha256-+VvWwBmxcgePV1L6kU2mSkg3emMiMgpdQnCqvQJkRPk=", + "lastModified": 1715106263, + "narHash": "sha256-a7iQ8pKGz6fghJrtXq0Xamp57GE8Hd3w5YQASzz5Wlk=", "owner": "holochain", "repo": "launcher", - "rev": "9d9cab5e6b57e1c278113921ff203e515c8bbd2e", + "rev": "92bd39e1c66912d61c35c4725d7b106959888670", "type": "github" }, "original": { "owner": "holochain", - "ref": "holochain-0.3", - "repo": "launcher", - "type": "github" - } - }, - "launcher_2": { - "flake": false, - "locked": { - "lastModified": 1717431387, - "narHash": "sha256-+VvWwBmxcgePV1L6kU2mSkg3emMiMgpdQnCqvQJkRPk=", - "owner": "holochain", - "repo": "launcher", - "rev": "9d9cab5e6b57e1c278113921ff203e515c8bbd2e", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "holochain-0.3", + "ref": "holochain-weekly", "repo": "launcher", "type": "github" } @@ -597,21 +472,6 @@ "type": "github" } }, - "nix-filter_2": { - "locked": { - "lastModified": 1705332318, - "narHash": "sha256-kcw1yFeJe9N4PjQji9ZeX47jg0p9A0DuU4djKvg1a7I=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "3449dc925982ad46246cfc36469baf66e1b64f17", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1716619601, @@ -628,20 +488,14 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1706550542, - "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", - "type": "github" + "lastModified": 1719876945, + "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" } }, "nixpkgs-lib_2": { @@ -664,17 +518,18 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1716293225, - "narHash": "sha256-pU9ViBVE3XYb70xZx+jK6SEVphvt7xMTbm6yDIF4xPs=", - "owner": "NixOS", + "lastModified": 1720542800, + "narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "3eaeaeb6b1e08a016380c279f8846e0bd8808916", + "rev": "feb2849fdeb70028c70d73b848214b00d324a497", "type": "github" }, "original": { - "id": "nixpkgs", + "owner": "nixos", "ref": "nixos-unstable", - "type": "indirect" + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs_3": { @@ -708,22 +563,6 @@ "type": "github" } }, - "pre-commit-hooks-nix_2": { - "flake": false, - "locked": { - "lastModified": 1707297608, - "narHash": "sha256-ADjo/5VySGlvtCW3qR+vdFF4xM9kJFlRDqcC9ZGI8EA=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "0db2e67ee49910adfa13010e7f012149660af7f0", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "repo-git": { "flake": false, "locked": { @@ -736,46 +575,35 @@ "url": "file:/dev/null" } }, - "repo-git_2": { - "flake": false, - "locked": { - "narHash": "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY=", - "type": "file", - "url": "file:/dev/null" - }, - "original": { - "type": "file", - "url": "file:/dev/null" - } - }, "root": { "inputs": { "amber": "amber", - "crane": "crane", - "flake-utils": "flake-utils", - "holochain": "holochain", + "flake-parts": [ + "holonix", + "flake-parts" + ], + "holonix": "holonix", "nixpkgs": [ - "holochain", + "holonix", "nixpkgs" ], "rust-overlay": "rust-overlay_2", - "tryorama": "tryorama", - "versions": "versions_2" + "tryorama": "tryorama" } }, "rust-overlay": { "inputs": { "nixpkgs": [ - "holochain", + "holonix", "nixpkgs" ] }, "locked": { - "lastModified": 1720318855, - "narHash": "sha256-w3CCVK9LJ5aznXGkO1IyAlbvMNJfyA+dBF7Z1Zwx1LA=", + "lastModified": 1720664424, + "narHash": "sha256-+odiMNHRYdvzL1ewl41UVFxsjmdoXfH+maQ8xvUoR4g=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "3eed08a074cd2000884a69d448d70da2843f7103", + "rev": "fec97e65fcbaab0decccba740ac8688f61dadd70", "type": "github" }, "original": { @@ -787,16 +615,16 @@ "rust-overlay_2": { "inputs": { "nixpkgs": [ - "holochain", + "holonix", "nixpkgs" ] }, "locked": { - "lastModified": 1720491570, - "narHash": "sha256-PHS2BcQ9kxBpu9GKlDg3uAlrX/ahQOoAiVmwGl6BjD4=", + "lastModified": 1720750737, + "narHash": "sha256-hPXe9Pr3s2EKRdDki3UkCKoPGlNkOhplCooNoC/L7Qc=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "b970af40fdc4bd80fd764796c5f97c15e2b564eb", + "rev": "a17c5d38c6fe47880eb8c6bede15d943ac2c4d17", "type": "github" }, "original": { @@ -807,7 +635,7 @@ }, "rust-overlay_3": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": [ "tryorama", "holonix", @@ -830,18 +658,18 @@ }, "rust-overlay_4": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "nixpkgs": [ "tryorama", "nixpkgs" ] }, "locked": { - "lastModified": 1718331519, - "narHash": "sha256-6Ru37wS8uec626nHVIh6hSpCYB7eNc3RPFa2U//bhw4=", + "lastModified": 1718158726, + "narHash": "sha256-nOt0XxRZ9ZwztX4OOKdS4YkPd3TVfz/PoaD8TiT7/vw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "419e7fae2731f41dd9b3e34dfe8802be68558b92", + "rev": "d4d933340cd3b35d3dc256d76abc3d510e21dfdc", "type": "github" }, "original": { @@ -853,33 +681,16 @@ "scaffolding": { "flake": false, "locked": { - "lastModified": 1717661456, - "narHash": "sha256-e+9YRRFJg89rfHDWtumEa33rpa2vmij/zw7Uwl6BP/g=", - "owner": "holochain", - "repo": "scaffolding", - "rev": "1ffc9eb350b82784a8fb609073f1c7eccf2e0fc0", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "holochain-0.3", - "repo": "scaffolding", - "type": "github" - } - }, - "scaffolding_2": { - "flake": false, - "locked": { - "lastModified": 1718803517, - "narHash": "sha256-TXefe4AJxnfcXDQa9V/rM1ieWybi043pTUI1td4xfzM=", + "lastModified": 1718124894, + "narHash": "sha256-ALDxuF+TZBbXrSp4r736M3MEFq0PgC5iMpzVIvkQwSc=", "owner": "holochain", "repo": "scaffolding", - "rev": "ea8dfd8ed4778184338edd3549711f94e70f780e", + "rev": "e4bf5486c59abf47a7ec6a97b93c1d2a1447a0d7", "type": "github" }, "original": { "owner": "holochain", - "ref": "holochain-0.3", + "ref": "holochain-weekly", "repo": "scaffolding", "type": "github" } @@ -929,27 +740,11 @@ "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" - } - }, "tryorama": { "inputs": { - "crane": "crane_3", - "holonix": "holonix", + "crane": "crane_2", + "holonix": "holonix_2", "nixpkgs": [ - "tryorama", "holonix", "nixpkgs" ], @@ -957,16 +752,16 @@ "versions": "versions" }, "locked": { - "lastModified": 1718362187, - "narHash": "sha256-bWr+Mc59vFZ00Y3p0FjvbpZEaZFmt9UUw04yt9xmAkk=", + "lastModified": 1718303526, + "narHash": "sha256-DJnHfRS6bpy6TcGCgnAWJrkoFaSubWEsVTQPcfEWQS4=", "owner": "holochain", "repo": "tryorama", - "rev": "0c983d068f8b1423c0e39b927bce63360b058826", + "rev": "b376544cb64ac396b4cc52fdcf6063e3e9b7b4b2", "type": "github" }, "original": { "owner": "holochain", - "ref": "v0.16.0", + "ref": "v0.17.0-dev.1", "repo": "tryorama", "type": "github" } @@ -997,39 +792,16 @@ "scaffolding": "scaffolding" }, "locked": { - "dir": "versions/0_3", - "lastModified": 1718285062, - "narHash": "sha256-FVXY8scfrt2QQ1v3iqAK8GTaMmSOClNFlI0/T+qZeTU=", - "owner": "holochain", - "repo": "holochain", - "rev": "4be2cfa4aa5d92dcea35f76aff344af5127e07fb", - "type": "github" - }, - "original": { - "dir": "versions/0_3", - "owner": "holochain", - "repo": "holochain", - "type": "github" - } - }, - "versions_2": { - "inputs": { - "holochain": "holochain_3", - "lair": "lair_2", - "launcher": "launcher_2", - "scaffolding": "scaffolding_2" - }, - "locked": { - "dir": "versions/0_3", - "lastModified": 1720481908, - "narHash": "sha256-UjKicjEFFZ/QtqqDEFDMeLyE7nC9by/2KYbXBVshqMA=", + "dir": "versions/weekly", + "lastModified": 1718224007, + "narHash": "sha256-uPOaySGH58H9hQS8fM/TfyYl2tIU9B7p6OcYlVPnuoY=", "owner": "holochain", "repo": "holochain", - "rev": "c30873ff7de7cb7234c973aeae3672507350870d", + "rev": "649ad4c97ecb0bb113139d1aff688b689853b292", "type": "github" }, "original": { - "dir": "versions/0_3", + "dir": "versions/weekly", "owner": "holochain", "repo": "holochain", "type": "github" diff --git a/flake.nix b/flake.nix index a87e14e8..e886bef5 100644 --- a/flake.nix +++ b/flake.nix @@ -2,99 +2,95 @@ description = "Flake for Holochain testing"; inputs = { - versions.url = "github:holochain/holochain?dir=versions/0_3"; + holonix.url = "github:holochain/holonix/main"; - holochain = { - url = "github:holochain/holochain"; - inputs.versions.follows = "versions"; - }; + nixpkgs.follows = "holonix/nixpkgs"; + flake-parts.follows = "holonix/flake-parts"; - tryorama.url = "github:holochain/tryorama/v0.16.0"; + tryorama = { + url = "github:holochain/tryorama/v0.17.0-dev.1"; + inputs = { + nixpkgs.follows = "holonix/nixpkgs"; - crane = { - url = "github:ipetkov/crane"; - inputs.nixpkgs.follows = "holochain/nixpkgs"; + }; }; - flake-utils.url = "github:numtide/flake-utils"; - rust-overlay = { url = "github:oxalica/rust-overlay"; inputs = { - nixpkgs.follows = "holochain/nixpkgs"; + nixpkgs.follows = "holonix/nixpkgs"; }; }; amber = { url = "github:Ph0enixKM/Amber"; - inputs.nixpkgs.follows = "holochain/nixpkgs"; + inputs.nixpkgs.follows = "holonix/nixpkgs"; }; - - nixpkgs.follows = "holochain/nixpkgs"; }; - outputs = inputs: - inputs.holochain.inputs.flake-parts.lib.mkFlake { inherit inputs; } + outputs = inputs@{ flake-parts, holonix, ... }: flake-parts.lib.mkFlake { inherit inputs; } ({ flake-parts-lib, ... }: { + systems = builtins.attrNames inputs.holonix.devShells; + perSystem = { inputs', pkgs, system, config, ... }: + let + rustMod = flake-parts-lib.importApply ./nix/modules/rust.nix { inherit (holonix.inputs) crane; inherit (inputs) nixpkgs rust-overlay; }; + in { - systems = builtins.attrNames inputs.holochain.devShells; imports = [ ./nix/modules/formatter.nix ./nix/modules/happs.nix - ./nix/modules/rust.nix + rustMod ./nix/modules/scenario.nix ./nix/modules/scenarios.nix ./nix/modules/workspace.nix ./nix/modules/zome.nix ./nix/modules/zomes.nix ]; - perSystem = { lib, config, pkgs, system, self', ... }: - { - devShells.default = pkgs.mkShell { - inputsFrom = [ - inputs.holochain.devShells.${system}.holonix - ]; - packages = [ - pkgs.influxdb2-cli - pkgs.influxdb2-server - # TODO https://docs.influxdata.com/telegraf/v1/install/#ntp - pkgs.telegraf - pkgs.yq - pkgs.httpie - pkgs.shellcheck - pkgs.statix - inputs.tryorama.packages.${system}.trycp-server - # inputs.amber.packages.${system}.default - ]; + devShells.default = pkgs.mkShell { + inputsFrom = [ inputs'.holonix.devShells ]; + + packages = (with inputs'.holonix.packages; [ + holochain + rust # For Rust development, with the WASM target included for zome builds + ]) ++ (with pkgs; [ + pkgs.influxdb2-cli + pkgs.influxdb2-server + # TODO https://docs.influxdata.com/telegraf/v1/install/#ntp + pkgs.telegraf + pkgs.yq + pkgs.httpie + pkgs.shellcheck + pkgs.statix + inputs.tryorama.packages.${system}.trycp-server + # inputs.amber.packages.${system}.default + ]); - shellHook = '' - source ./scripts/influx.sh - source ./scripts/telegraf.sh - source ./scripts/trycp.sh - source ./scripts/checks.sh - ''; - }; + shellHook = '' + source ./scripts/influx.sh + source ./scripts/telegraf.sh + source ./scripts/trycp.sh + source ./scripts/checks.sh + ''; + }; - devShells.ci = pkgs.mkShell { - inputsFrom = [ - inputs.holochain.devShells.${system}.holochainBinaries - ]; + devShells.ci = pkgs.mkShell { + inputsFrom = [ inputs'.holonix.devShells ]; - packages = [ - pkgs.shellcheck - pkgs.statix - inputs.tryorama.packages.${system}.trycp-server - ]; - }; + packages = [ + pkgs.shellcheck + pkgs.statix + inputs.tryorama.packages.${system}.trycp-server + ]; + }; - packages = { - default = config.workspace.workspace; - inherit (config.workspace) workspace; - }; + packages = { + default = config.workspace.workspace; + inherit (config.workspace) workspace; + }; - checks = { - inherit (config.workspace) workspace_clippy; - }; - }; + checks = { + inherit (config.workspace) workspace_clippy; + }; }; + }); } diff --git a/nix/modules/formatter.nix b/nix/modules/formatter.nix index 2be5633f..f1f93d3f 100644 --- a/nix/modules/formatter.nix +++ b/nix/modules/formatter.nix @@ -1,6 +1,3 @@ -{ self, lib, ... }: { - perSystem = { config, self', inputs', pkgs, ... }: { - # define formatter used by `nix fmt` - formatter = pkgs.nixpkgs-fmt; - }; +{ pkgs, ... }: { + formatter = pkgs.nixpkgs-fmt; } diff --git a/nix/modules/happs.nix b/nix/modules/happs.nix index 4d2cc7cb..ec9767cf 100644 --- a/nix/modules/happs.nix +++ b/nix/modules/happs.nix @@ -1,175 +1,174 @@ # Module for building hApps and DNAs from the requirements specified in the metadata section of a Cargo.toml -{ self, inputs, lib, ... }@flake: { - perSystem = { config, self', inputs', system, pkgs, ... }: - let - inherit (config.rustHelper) craneLib; - - zomeHasIntegrity = zome_name: builtins.hasAttr "${zome_name}_integrity" self'.packages; - in - { - options.happHelper = lib.mkOption { type = lib.types.raw; }; - - config.happHelper = { - mkHapps = { configToml }: - let - config = builtins.fromTOML (builtins.readFile configToml); - inherit (config.package) metadata; - - requiredDnas = - if builtins.hasAttr "required-dna" metadata then - if builtins.isList metadata."required-dna" then - metadata."required-dna" - else - [ metadata."required-dna" ] - else - [ ]; - - # - # - # This section contains DNA build logic - # - # - - mkDnaManifest = { name, zomes }: { - manifest_version = "1"; - inherit name; - - coordinator = { - zomes = builtins.map - (zome_name: - { - name = zome_name; - hash = null; - # Relying on referencing a derivation here and having Nix convert that to the store path of that derivation when it's converted to a string - bundled = "${self'.packages."${zome_name}_coordinator"}/lib/${zome_name}_coordinator.wasm"; - dependencies = - if builtins.hasAttr "${zome_name}_integrity" self'.packages then - [{ name = "${zome_name}_integrity"; }] - else - [ ]; - dylib = null; - } - ) - zomes; - }; - - integrity = { - network_seed = null; - properties = null; - origin_time = 1710431275; - zomes = builtins.map - (zome_name: { - name = "${zome_name}_integrity"; - hash = null; - # Relying on referencing a derivation here and having Nix convert that to the store path of that derivation when it's converted to a string - bundled = "${self'.packages."${zome_name}_integrity"}/lib/${zome_name}_integrity.wasm"; - dependencies = null; - dylib = null; - }) - (builtins.filter zomeHasIntegrity zomes); - }; - }; - - mkDnaBuildScript = manifest: '' - mkdir -p ./${manifest.name} - echo '${lib.generators.toYAML {} manifest}' > ./${manifest.name}/dna.yaml - - hc dna pack --output ./${manifest.name}.dna ./${manifest.name} - ''; - - mkDnaBuildScripts = manifests: - builtins.concatStringsSep "\n" (map mkDnaBuildScript manifests); - - # - # - # This section contains hApp build logic - # - # - - requiredHapps = - if builtins.hasAttr "required-happ" metadata then - if builtins.isList metadata."required-happ" then - metadata."required-happ" - else - [ metadata."required-happ" ] - else - [ ]; - - mkHappManifest = { name, dnas }: { - manifest_version = "1"; - inherit name; - description = "A Wind Tunnel sample hApp"; - - roles = builtins.map - (dna_name: - { - name = dna_name; - - provisioning = { - strategy = "create"; - deferred = false; - }; - - dna = { - # These are built as part of this derivation so look for them in the build directory - bundled = "../${dna_name}.dna"; - }; - - modifiers = { - network_seed = null; - properties = null; - origin_time = null; - quantum_time = null; - }; - installed_hash = null; - clone_limit = 0; - } - ) - dnas; - }; - - mkHappBuildScript = manifest: '' - mkdir -p ./${manifest.name} - echo '${lib.generators.toYAML {} manifest}' > ./${manifest.name}/happ.yaml - - mkdir -p $out/${manifest.name} - hc app pack --output $out/${manifest.name}.happ ./${manifest.name} - ''; - - mkHappBuildScripts = manifests: - builtins.concatStringsSep "\n" (map mkHappBuildScript manifests); - - # - # - # Figure out what zome packages are required as inputs to this derivation - # - # - requiredZomes = lib.lists.unique (lib.lists.flatten (map (builtins.getAttr "zomes") requiredDnas)); - - # The zome packages that this derivation depends on - zomeDeps = builtins.map (zome_name: [ self'.packages."${zome_name}_coordinator" ] ++ (if zomeHasIntegrity zome_name then [ self'.packages."${zome_name}_integrity" ] else [ ])) requiredZomes; - in - pkgs.stdenv.mkDerivation { - inherit (config.package) name; - - # This is all based on workspace code, so rely on the Crane filter to select the right sources. - src = craneLib.cleanCargoSource (craneLib.path ./../..); - - buildInputs = zomeDeps ++ [ - # Need `hc` to package DNAs and hApps. - inputs.holochain.packages.${system}.holochain - ]; - - postInstall = '' - # Ensure the derivation is not empty if there are ne hApps requested - mkdir -p $out - touch $out/.happ-build - - ${mkDnaBuildScripts (map mkDnaManifest requiredDnas)} - ${mkHappBuildScripts (map mkHappManifest requiredHapps)} - ''; +{ config, self', inputs', system, pkgs, lib, ... }: + +let + inherit (config.rustHelper) craneLib; + + zomeHasIntegrity = zome_name: builtins.hasAttr "${zome_name}_integrity" self'.packages; +in +{ + options.happHelper = lib.mkOption { type = lib.types.raw; }; + + config.happHelper = { + mkHapps = { configToml }: + let + config = builtins.fromTOML (builtins.readFile configToml); + inherit (config.package) metadata; + + requiredDnas = + if builtins.hasAttr "required-dna" metadata then + if builtins.isList metadata."required-dna" then + metadata."required-dna" + else + [ metadata."required-dna" ] + else + [ ]; + + # + # + # This section contains DNA build logic + # + # + + mkDnaManifest = { name, zomes }: { + manifest_version = "1"; + inherit name; + + coordinator = { + zomes = builtins.map + (zome_name: + { + name = zome_name; + hash = null; + # Relying on referencing a derivation here and having Nix convert that to the store path of that derivation when it's converted to a string + bundled = "${self'.packages."${zome_name}_coordinator"}/lib/${zome_name}_coordinator.wasm"; + dependencies = + if builtins.hasAttr "${zome_name}_integrity" self'.packages then + [{ name = "${zome_name}_integrity"; }] + else + [ ]; + dylib = null; + } + ) + zomes; }; + + integrity = { + network_seed = null; + properties = null; + origin_time = 1710431275; + zomes = builtins.map + (zome_name: { + name = "${zome_name}_integrity"; + hash = null; + # Relying on referencing a derivation here and having Nix convert that to the store path of that derivation when it's converted to a string + bundled = "${self'.packages."${zome_name}_integrity"}/lib/${zome_name}_integrity.wasm"; + dependencies = null; + dylib = null; + }) + (builtins.filter zomeHasIntegrity zomes); + }; + }; + + mkDnaBuildScript = manifest: '' + mkdir -p ./${manifest.name} + echo '${lib.generators.toYAML {} manifest}' > ./${manifest.name}/dna.yaml + + hc dna pack --output ./${manifest.name}.dna ./${manifest.name} + ''; + + mkDnaBuildScripts = manifests: + builtins.concatStringsSep "\n" (map mkDnaBuildScript manifests); + + # + # + # This section contains hApp build logic + # + # + + requiredHapps = + if builtins.hasAttr "required-happ" metadata then + if builtins.isList metadata."required-happ" then + metadata."required-happ" + else + [ metadata."required-happ" ] + else + [ ]; + + mkHappManifest = { name, dnas }: { + manifest_version = "1"; + inherit name; + description = "A Wind Tunnel sample hApp"; + + roles = builtins.map + (dna_name: + { + name = dna_name; + + provisioning = { + strategy = "create"; + deferred = false; + }; + + dna = { + # These are built as part of this derivation so look for them in the build directory + bundled = "../${dna_name}.dna"; + }; + + modifiers = { + network_seed = null; + properties = null; + origin_time = null; + quantum_time = null; + }; + installed_hash = null; + clone_limit = 0; + } + ) + dnas; + }; + + mkHappBuildScript = manifest: '' + mkdir -p ./${manifest.name} + echo '${lib.generators.toYAML {} manifest}' > ./${manifest.name}/happ.yaml + + mkdir -p $out/${manifest.name} + hc app pack --output $out/${manifest.name}.happ ./${manifest.name} + ''; + + mkHappBuildScripts = manifests: + builtins.concatStringsSep "\n" (map mkHappBuildScript manifests); + + # + # + # Figure out what zome packages are required as inputs to this derivation + # + # + requiredZomes = lib.lists.unique (lib.lists.flatten (map (builtins.getAttr "zomes") requiredDnas)); + + # The zome packages that this derivation depends on + zomeDeps = builtins.map (zome_name: [ self'.packages."${zome_name}_coordinator" ] ++ (if zomeHasIntegrity zome_name then [ self'.packages."${zome_name}_integrity" ] else [ ])) requiredZomes; + in + pkgs.stdenv.mkDerivation { + inherit (config.package) name; + + # This is all based on workspace code, so rely on the Crane filter to select the right sources. + src = craneLib.cleanCargoSource (craneLib.path ./../..); + + buildInputs = zomeDeps ++ [ + # Need `hc` to package DNAs and hApps. + inputs'.holonix.packages.holochain + ]; + + postInstall = '' + # Ensure the derivation is not empty if there are ne hApps requested + mkdir -p $out + touch $out/.happ-build + + ${mkDnaBuildScripts (map mkDnaManifest requiredDnas)} + ${mkHappBuildScripts (map mkHappManifest requiredHapps)} + ''; }; - }; + }; } diff --git a/nix/modules/rust.nix b/nix/modules/rust.nix index 40c9b487..e268171a 100644 --- a/nix/modules/rust.nix +++ b/nix/modules/rust.nix @@ -1,31 +1,30 @@ # Module to configure Rust and Crane for use in other modules. -{ self, inputs, lib, ... }@flake: { - perSystem = { config, self', inputs', system, pkgs, ... }: - let - rustPkgs = import inputs.nixpkgs { - inherit system; - overlays = [ (import inputs.rust-overlay) ]; - }; +{ crane, nixpkgs, rust-overlay }: +{ config, self', inputs', system, pkgs, lib, ... }: +let + rustPkgs = import nixpkgs { + inherit system; + overlays = [ (import rust-overlay) ]; + }; - rustVersion = "1.78.0"; + rustVersion = "1.78.0"; - rustWithWasmTarget = rustPkgs.rust-bin.stable."${rustVersion}".minimal.override { - targets = [ "wasm32-unknown-unknown" ]; - extensions = [ "clippy" ]; - }; + rustWithWasmTarget = rustPkgs.rust-bin.stable."${rustVersion}".minimal.override { + targets = [ "wasm32-unknown-unknown" ]; + extensions = [ "clippy" ]; + }; - craneLib = (inputs.crane.mkLib rustPkgs).overrideToolchain rustWithWasmTarget; - in - { - options.rustHelper = lib.mkOption { type = lib.types.raw; }; + craneLib = (crane.mkLib rustPkgs).overrideToolchain rustWithWasmTarget; +in +{ + options.rustHelper = lib.mkOption { type = lib.types.raw; }; - config.rustHelper = { - findCrateVersion = cargoToml: (craneLib.crateNameFromCargoToml { inherit cargoToml; }).version; + config.rustHelper = { + findCrateVersion = cargoToml: (craneLib.crateNameFromCargoToml { inherit cargoToml; }).version; - inherit craneLib; + inherit craneLib; - rust = rustWithWasmTarget; - }; - }; + rust = rustWithWasmTarget; + }; } diff --git a/nix/modules/scenario.nix b/nix/modules/scenario.nix index 2d859c6f..708fdcec 100644 --- a/nix/modules/scenario.nix +++ b/nix/modules/scenario.nix @@ -1,51 +1,49 @@ # Module to build scenarios and their required hApps into a single derivation -{ self, inputs, lib, ... }@flake: { - perSystem = { config, self', inputs', system, pkgs, ... }: - let - inherit (config.rustHelper) craneLib; - - mkPackage = { name }: craneLib.buildPackage (config.workspace.commonArgs // { - pname = name; - version = config.rustHelper.findCrateVersion ../../scenarios/${name}/Cargo.toml; - - inherit (config.workspace) cargoArtifacts; - - cargoExtraArgs = "-p ${name}"; - SKIP_HAPP_BUILD = "1"; - }); - in - { - options.scenarioHelper = lib.mkOption { type = lib.types.raw; }; - - config.scenarioHelper = { - mkScenario = { name }: - let - scenarioBinary = mkPackage { inherit name; }; - scenarioHapps = config.happHelper.mkHapps { configToml = ../../scenarios/${name}/Cargo.toml; }; - in - pkgs.stdenv.mkDerivation { - inherit name; - - # No sources to copy, everything comes from the build inputs - unpackPhase = "true"; - - buildInputs = [ scenarioBinary scenarioHapps ]; - - # To tell `nix run` which binary to run. It gets it right anyway because there is only one binary but - # it prints an annoying warning message. - meta = { - mainProgram = name; - }; - - postInstall = '' - mkdir -p $out/bin - cp "${scenarioBinary}/bin/${name}" $out/bin/ - - mkdir -p $out/happs - cp ${scenarioHapps}/.happ-build ${scenarioHapps}/*.happ $out/happs - ''; - }; +{ config, self', inputs', system, pkgs, lib, ... }: +let + inherit (config.rustHelper) craneLib; + + mkPackage = { name }: craneLib.buildPackage (config.workspace.commonArgs // { + pname = name; + version = config.rustHelper.findCrateVersion ../../scenarios/${name}/Cargo.toml; + + inherit (config.workspace) cargoArtifacts; + + cargoExtraArgs = "-p ${name}"; + SKIP_HAPP_BUILD = "1"; + }); +in +{ + options.scenarioHelper = lib.mkOption { type = lib.types.raw; }; + + config.scenarioHelper = { + mkScenario = { name }: + let + scenarioBinary = mkPackage { inherit name; }; + scenarioHapps = config.happHelper.mkHapps { configToml = ../../scenarios/${name}/Cargo.toml; }; + in + pkgs.stdenv.mkDerivation { + inherit name; + + # No sources to copy, everything comes from the build inputs + unpackPhase = "true"; + + buildInputs = [ scenarioBinary scenarioHapps ]; + + # To tell `nix run` which binary to run. It gets it right anyway because there is only one binary but + # it prints an annoying warning message. + meta = { + mainProgram = name; + }; + + postInstall = '' + mkdir -p $out/bin + cp "${scenarioBinary}/bin/${name}" $out/bin/ + + mkdir -p $out/happs + cp ${scenarioHapps}/.happ-build ${scenarioHapps}/*.happ $out/happs + ''; }; - }; + }; } diff --git a/nix/modules/scenarios.nix b/nix/modules/scenarios.nix index 252fef73..b2ec875a 100644 --- a/nix/modules/scenarios.nix +++ b/nix/modules/scenarios.nix @@ -1,22 +1,20 @@ # Helper module to discover all scenarios and build packages for each. -{ self, inputs, lib, ... }@flake: { - perSystem = { config, self', inputs', system, pkgs, ... }: - let - scenario_names = builtins.filter (name: !(lib.strings.hasInfix "." name)) (builtins.attrNames (builtins.readDir ../../scenarios)); +{ config, self', inputs', system, pkgs, lib, ... }: +let + scenario_names = builtins.filter (name: !(lib.strings.hasInfix "." name)) (builtins.attrNames (builtins.readDir ../../scenarios)); - scenarios = map - (name: { - inherit name; - value = config.scenarioHelper.mkScenario { - inherit name; - }; - }) - scenario_names; - in - { - packages = builtins.listToAttrs scenarios; + scenarios = map + (name: { + inherit name; + value = config.scenarioHelper.mkScenario { + inherit name; + }; + }) + scenario_names; +in +{ + packages = builtins.listToAttrs scenarios; - apps = builtins.listToAttrs (builtins.map ({ name, value }: { inherit name; value = { program = value; }; }) scenarios); - }; + apps = builtins.listToAttrs (builtins.map ({ name, value }: { inherit name; value = { program = value; }; }) scenarios); } diff --git a/nix/modules/workspace.nix b/nix/modules/workspace.nix index 1567cb74..009ec310 100644 --- a/nix/modules/workspace.nix +++ b/nix/modules/workspace.nix @@ -1,63 +1,61 @@ -{ self, inputs, lib, ... }@flake: { - perSystem = { config, self', inputs', system, pkgs, ... }: - let - inherit (config.rustHelper) craneLib; - - opensslStatic = - if system == "x86_64-darwin" - then pkgs.openssl # pkgsStatic is considered a cross build and this is not yet supported - else pkgs.pkgsStatic.openssl; - - nonCargoBuildFiles = path: _type: builtins.match ".*conductor-config.yaml$" path != null; - includeFilesFilter = path: type: - (craneLib.filterCargoSources path type) || (nonCargoBuildFiles path type); - - commonArgs = { - pname = "workspace"; - version = "0.1.0"; - - src = pkgs.lib.cleanSourceWith { - src = ./../..; - filter = includeFilesFilter; - }; - strictDeps = true; - - cargoExtraArgs = "--locked --workspace"; - SKIP_HAPP_BUILD = "1"; - - buildInputs = with pkgs; [ - # Some Holochain crates link against openssl - openssl - opensslStatic - ]; - - nativeBuildInputs = with pkgs; [ - # To build openssl-sys - perl - pkg-config - # Because the holochain_client depends on Kitsune/tx5 - go - ]; - }; - - cargoArtifacts = craneLib.buildDepsOnly (commonArgs // { - pname = "${commonArgs.pname}-deps"; - }); - - workspace = craneLib.buildPackage (commonArgs // { - inherit cargoArtifacts; - }); - - workspace_clippy = craneLib.cargoClippy (commonArgs // { - inherit cargoArtifacts; - cargoClippyExtraArgs = "--all-targets --all-features -- --deny warnings"; - }); - in - { - options.workspace = lib.mkOption { type = lib.types.raw; }; - - config.workspace = { - inherit commonArgs cargoArtifacts workspace workspace_clippy; - }; +{ config, self', inputs', system, pkgs, lib, ... }: +let + inherit (config.rustHelper) craneLib; + + opensslStatic = + if system == "x86_64-darwin" + then pkgs.openssl # pkgsStatic is considered a cross build and this is not yet supported + else pkgs.pkgsStatic.openssl; + + nonCargoBuildFiles = path: _type: builtins.match ".*conductor-config.yaml$" path != null; + includeFilesFilter = path: type: + (craneLib.filterCargoSources path type) || (nonCargoBuildFiles path type); + + commonArgs = { + pname = "workspace"; + version = "0.1.0"; + + src = pkgs.lib.cleanSourceWith { + src = ./../..; + filter = includeFilesFilter; }; + strictDeps = true; + + cargoExtraArgs = "--locked --workspace"; + SKIP_HAPP_BUILD = "1"; + + buildInputs = with pkgs; [ + # Some Holochain crates link against openssl + openssl + opensslStatic + ]; + + nativeBuildInputs = with pkgs; [ + # To build openssl-sys + perl + pkg-config + # Because the holochain_client depends on Kitsune/tx5 + go + ]; + }; + + cargoArtifacts = craneLib.buildDepsOnly (commonArgs // { + pname = "${commonArgs.pname}-deps"; + }); + + workspace = craneLib.buildPackage (commonArgs // { + inherit cargoArtifacts; + }); + + workspace_clippy = craneLib.cargoClippy (commonArgs // { + inherit cargoArtifacts; + cargoClippyExtraArgs = "--all-targets --all-features -- --deny warnings"; + }); +in +{ + options.workspace = lib.mkOption { type = lib.types.raw; }; + + config.workspace = { + inherit commonArgs cargoArtifacts workspace workspace_clippy; + }; } diff --git a/nix/modules/zome.nix b/nix/modules/zome.nix index 55fe7ef4..856ca91d 100644 --- a/nix/modules/zome.nix +++ b/nix/modules/zome.nix @@ -1,28 +1,30 @@ # Module for building zome WASMs -{ self, inputs, lib, ... }@flake: { - perSystem = { config, self', inputs', system, pkgs, ... }: - let - inherit (config.rustHelper) craneLib; - in - { - options.zomeHelper = lib.mkOption { type = lib.types.raw; }; +{ config, lib, ... }: +let + inherit (config.rustHelper) craneLib; - config.zomeHelper = { - mkZome = { name, kind }: - let - packageName = if kind == "integrity" then "${name}_${kind}" else name; - in - craneLib.buildPackage (config.workspace.commonArgs // { - pname = "${name}_${kind}"; - version = config.rustHelper.findCrateVersion ../../zomes/${name}/${kind}/Cargo.toml; + x = builtins.trace craneLib craneLib; +in +{ + options.zomeHelper = lib.mkOption { type = lib.types.raw; }; - inherit (config.workspace) cargoArtifacts; + config.zomeHelper = { + mkZome = { name, kind }: + let + x = builtins.trace "hello" "hello"; - doCheck = false; + packageName = if kind == "integrity" then "${name}_${kind}" else name; + in + craneLib.buildPackage (config.workspace.commonArgs // { + pname = "${name}_${kind}"; + version = config.rustHelper.findCrateVersion ../../zomes/${name}/${kind}/Cargo.toml; - cargoExtraArgs = "-p ${packageName} --lib --target wasm32-unknown-unknown"; - }); - }; - }; + inherit (config.workspace) cargoArtifacts; + + doCheck = false; + + cargoExtraArgs = "-p ${packageName} --lib --target wasm32-unknown-unknown"; + }); + }; } diff --git a/nix/modules/zomes.nix b/nix/modules/zomes.nix index bfb000ea..70af0c27 100644 --- a/nix/modules/zomes.nix +++ b/nix/modules/zomes.nix @@ -1,15 +1,13 @@ # Helper module to discover all the zomes in the zomes directory and create a package for each one -{ self, inputs, lib, ... }@flake: { - perSystem = { config, self', inputs', system, pkgs, ... }: - let - zome_names = builtins.filter (name: !(lib.strings.hasInfix "." name)) (builtins.attrNames (builtins.readDir ../../zomes)); +{ config, lib, ... }: +let + zome_names = builtins.filter (name: !(lib.strings.hasInfix "." name)) (builtins.attrNames (builtins.readDir ../../zomes)); - zome_names_with_types = builtins.map (zome_name: builtins.map (kind: { name = zome_name; inherit kind; }) (builtins.attrNames (builtins.readDir ../../zomes/${zome_name}))) zome_names; + zome_names_with_types = builtins.map (zome_name: builtins.map (kind: { name = zome_name; inherit kind; }) (builtins.attrNames (builtins.readDir ../../zomes/${zome_name}))) zome_names; - named_zomes = builtins.map ({ name, kind } @ input: { name = "${name}_${kind}"; value = config.zomeHelper.mkZome input; }) (lib.lists.flatten zome_names_with_types); - in - { - packages = builtins.listToAttrs named_zomes; - }; + named_zomes = builtins.map ({ name, kind } @ input: { name = "${name}_${kind}"; value = config.zomeHelper.mkZome input; }) (lib.lists.flatten zome_names_with_types); +in +{ + packages = builtins.listToAttrs named_zomes; }