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-18 11:06:17 +02:00

56 lines
1.4 KiB
Nix

flakeModuleArgs@{ config, lib, inputs, ... }:
{
imports = [
inputs.pre-commit-hooks-nix.flakeModule
];
systems = [ "x86_64-linux" "aarch64-darwin" ];
perSystem = system: { config, self', inputs', pkgs, ... }: {
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.nixpkgs-fmt
pkgs.pre-commit
];
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;
};
};
packages = {
inherit (pkgs.nixosOptionsDoc { inherit (flakeModuleArgs) options; })
optionsDocBook;
optionsMarkdown = pkgs.runCommand "options-markdown"
{
inherit (config.packages) optionsDocBook;
nativeBuildInputs = [ pkgs.pandoc ];
} ''
mkdir $out
pandoc \
--from docbook \
--to markdown \
--output $out/options.md \
$optionsDocBook
'';
};
};
flake = {
options.herculesCI = lib.mkOption { type = lib.types.raw; };
config.herculesCI = {
onPush.default.outputs = {
inherit (config.flake) packages checks;
};
};
# for repl exploration / debug
config.config = config;
options.mySystem = lib.mkOption { default = config.allSystems.${builtins.currentSystem}; };
};
}