From 45fc384fe393d468e678a8cdf09954a9ee11c40f Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 11 Nov 2022 08:00:22 +0100 Subject: [PATCH] Use flakeModule based automatic herculesCI.onPush --- dev/default.nix | 1 + dev/flake-module.nix | 31 +++++++++++++------------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/dev/default.nix b/dev/default.nix index d6d28a4..6fa49dd 100644 --- a/dev/default.nix +++ b/dev/default.nix @@ -4,6 +4,7 @@ let self = { inherit (flake) inputs; outPath = ../.; # used by pre-commit module, etc + outputs = self.config.flake; } // fmc-lib.evalFlakeModule { inherit self; } diff --git a/dev/flake-module.nix b/dev/flake-module.nix index 78777a2..c50acaf 100644 --- a/dev/flake-module.nix +++ b/dev/flake-module.nix @@ -30,25 +30,20 @@ }; }; - flake = { - # Because of ./README.md, we can't use the built-in flake support, including - # the `effects` flake attribute. We have to define `herculesCI` ourselves. - options.herculesCI = lib.mkOption { type = lib.types.raw; }; - config.herculesCI = { branch, ... }: { - onPush.default.outputs = { - inherit (config.flake) packages checks; - effects = - withSystem "x86_64-linux" ({ config, pkgs, effects, ... }: { - netlifyDeploy = effects.netlifyDeploy { - content = config.packages.siteContent; - secretName = "default-netlify"; - siteId = "29a153b1-3698-433c-bc73-62415efb8117"; - productionDeployment = branch == "main"; - }; - }); - }; + herculesCI = herculesCI@{ config, ... }: { + onPush.default.outputs = { + effects = + withSystem "x86_64-linux" ({ config, pkgs, effects, ... }: { + netlifyDeploy = effects.netlifyDeploy { + content = config.packages.siteContent; + secretName = "default-netlify"; + siteId = "29a153b1-3698-433c-bc73-62415efb8117"; + productionDeployment = herculesCI.config.repo.branch == "main"; + }; + }); }; - + }; + flake = { # for repl exploration / debug config.config = config; options.mySystem = lib.mkOption { default = config.allSystems.${builtins.currentSystem}; };