From 5a628a0994af95979f4b353e29565c324c3066f8 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 29 May 2022 18:06:04 +0200 Subject: [PATCH] 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. --- dev/flake.lock | 6 +++--- flake.lock | 27 +++++++++++++++++++++++++++ site/flake-module.nix | 20 +++++++++++++++++--- 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 flake.lock diff --git a/dev/flake.lock b/dev/flake.lock index 848cac1..d95d808 100644 --- a/dev/flake.lock +++ b/dev/flake.lock @@ -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": { diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7d199d9 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/site/flake-module.nix b/site/flake-module.nix index 06b6710..26ace5f 100644 --- a/site/flake-module.nix +++ b/site/flake-module.nix @@ -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 = '' @@ -82,7 +93,10 @@ ''; 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