1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00

Add pre-commit-hooks.nix to the docs

Ultimately Hercules CI should take care of the dependency injection,
but let's make a start first.
This commit is contained in:
Robert Hensing 2022-05-29 18:06:04 +02:00
parent 88ee50725f
commit 5a628a0994
3 changed files with 47 additions and 6 deletions

View file

@ -73,11 +73,11 @@
]
},
"locked": {
"lastModified": 1653494825,
"narHash": "sha256-hMhnHZGRlJBX3yWIvxuYIBo4g+XQy/DJ4z7ti0IX7x0=",
"lastModified": 1653840245,
"narHash": "sha256-6bqmsp5r+Ct7Il09M40WeRDBhjmUe56RhIT0RZPY+NE=",
"owner": "hercules-ci",
"repo": "pre-commit-hooks.nix",
"rev": "89b64b7aca69fbd2957232d6a5a36bb93ad59d4b",
"rev": "596dac761042d9ba90a507d43ad506cb952c984d",
"type": "github"
},
"original": {

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1653581809,
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,10 +1,14 @@
{ ... }: {
{ inputs, ... }: {
perSystem = { config, self', inputs', pkgs, lib, ... }:
let
inherit (lib) filter any hasPrefix concatMap removePrefix;
libNix = import ../lib.nix { inherit lib; };
eval = libNix.evalFlakeModule { self = { }; } { };
eval = libNix.evalFlakeModule { self = { inputs = { inherit (inputs) nixpkgs; }; }; } {
imports = [
inputs.pre-commit-hooks-nix.flakeModule
];
};
opts = eval.options;
filterTransformOptions = { sourceName, sourcePath, baseUrl }:
@ -61,6 +65,13 @@
baseUrl = "https://github.com/hercules-ci/flake-parts/blob/main";
sourcePath = ../.;
};
# TODO make this a dynamic input
pre_commit_hooks_nixOptions = optionsDoc {
title = "pre-commit-hooks.nix";
sourceName = "pre-commit-hooks.nix";
baseUrl = "https://github.com/hercules-ci/pre-commit-hooks.nix/blob/flakeModule";
sourcePath = inputs.pre-commit-hooks-nix;
};
# pandoc
htmlBefore = ''
<html>
@ -82,7 +93,10 @@
</html>
'';
buildPhase = ''
(echo "$htmlBefore"; pandoc --verbose --from docbook --to html5 $coreOptions; echo "$htmlAfter"; ) >options.html
( echo "$htmlBefore";
pandoc --verbose --from docbook --to html5 $coreOptions;
pandoc --verbose --from docbook --to html5 $pre_commit_hooks_nixOptions;
echo "$htmlAfter"; ) >options.html
'';
installPhase = ''
mkdir -p $out