hercules-ci-effects
hercules-ci-effects copied to clipboard
Documentation for 'Hello World' effect
I'm unable to adapt https://docs.hercules-ci.com/hercules-ci-effects/guide/write-a-custom-effect/ for flake.nix
Could we have docs on adding the simplest effect?
Here's what I tried:
https://github.com/srid/haskell.page/commit/0e08e8f0e9eb84c3c6555991a65315925fbb7f29#diff-206b9ce276ab5971a2489d75eb1b12999d4bf3843b7988cbe8d687cfde61dea0R13

(I assumed that the agent would iterate all top-level attres looking for 'effect' objects)
But, the agent doesn't seem to recognize any effects?
https://hercules-ci.com/github/srid/haskell.page/jobs/8

The problem is with the traversal. It follows the rules of nix-build
and nix-env -q
regarding recurseForDerivations
aka recurseIntoAttrs
.
This will be fixed in the 0.9
release, which can perform a simpler traversal, but until then, you could re-expose the relevant flake attrs with recurseIntoAttrs
calls in default.nix
.
Or you could use https://github.com/hercules-ci/flake-compat-ci, even if it's a stop-gap solution.
Or you could use https://github.com/hercules-ci/flake-compat-ci, even if it's a stop-gap solution.
Okay, trying that:
https://github.com/srid/haskell.page/commit/81568655b33c3673c29ac2784a01f4d2de61ae2c
Still the same issue:
https://hercules-ci.com/github/srid/haskell.page/jobs/12
I've updated flake-compat-ci
to expose effects. It expects the flake output:
outputs = { self, ..... }: {
effects.helloWorld = ....;
} // yourExistingOutputsIncludingFlakeCompatCi;
ie not per system. Generally you want to run effects once per real-world object rather than for all each possible system
.
diff --git a/flake.lock b/flake.lock
index 6eba55d..3f7512d 100644
--- a/flake.lock
+++ b/flake.lock
@@ -40,11 +40,11 @@
},
"flake-compat-ci": {
"locked": {
- "lastModified": 1629629549,
- "narHash": "sha256-c6Hipyp52MZ2pTFXEIRdcLK2rtKt9jggCQ7ZOgBS44k=",
+ "lastModified": 1638753619,
+ "narHash": "sha256-uJoNBfbXkn17W5PIrtQDPEk+zfN91oOB9I9XF9pOTmo=",
"owner": "hercules-ci",
"repo": "flake-compat-ci",
- "rev": "ef10daf1cb1823086ed547d39806aaca4c53cc17",
+ "rev": "e950b4e71c711f3311cbf6323394c0aff7b7e4ec",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 0a95f27..0618268 100644
--- a/flake.nix
+++ b/flake.nix
@@ -23,6 +23,9 @@
# Example: [ "x86_64-darwin" "aarch64-linux" ];
systems = [ "x86_64-linux" ];
};
+
+ effects.helloEffect = self.helloEffect.x86_64-linux;
+
} //
flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ] (system:
let
I applied this in https://github.com/srid/haskell.page/commit/7a105d260227129f68f87f00051a61b686375b7a
Result: https://hercules-ci.com/github/srid/haskell.page/jobs/15
Effects still not showing up, and there is also:
