1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00
flake-parts/dev/flake-module.nix
2022-05-25 16:20:28 +02:00

57 lines
1.6 KiB
Nix

{ config, lib, inputs, ... }:
{
imports = [
inputs.pre-commit-hooks-nix.flakeModule
../site/flake-module.nix
];
systems = [ "x86_64-linux" "aarch64-darwin" ];
perSystem = system: { config, self', inputs', pkgs, ... }: {
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.nixpkgs-fmt
pkgs.pre-commit
pkgs.hci
pkgs.netlify-cli
pkgs.pandoc
];
shellHook = ''
${config.pre-commit.installationScript}
'';
};
pre-commit = {
inherit pkgs; # should make this default to the one it can get via follows
settings = {
hooks.nixpkgs-fmt.enable = true;
};
};
};
flake = {
options.herculesCI = lib.mkOption { type = lib.types.raw; };
config.herculesCI = { branch, ... }: {
onPush.default.outputs = {
inherit (config.flake) packages checks;
effects =
let
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
effects = inputs.hercules-ci-effects.lib.withPkgs pkgs;
in
{
netlifyDeploy = effects.runIf (branch == "main") (effects.netlifyDeploy {
content = config.flake.packages.x86_64-linux.siteContent;
secretName = "default-netlify";
siteId = "29a153b1-3698-433c-bc73-62415efb8117";
productionDeployment = true;
});
};
};
};
# for repl exploration / debug
config.config = config;
options.mySystem = lib.mkOption { default = config.allSystems.${builtins.currentSystem}; };
};
}