mirror of
https://github.com/Mic92/sops-nix.git
synced 2026-07-17 06:25:16 +08:00
generate nixos options documentation
This commit is contained in:
parent
2f375ed870
commit
915c07e4c5
3 changed files with 38 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
{ pkgs ? import <nixpkgs> {}
|
{ pkgs ? import <nixpkgs> {}
|
||||||
, vendorHash ? "sha256-6oK/+aOQdW+Tes1zUE65RGizeB86Wgn1hl+2lVI4YbM="
|
, vendorHash ? "sha256-MKvLOkEIMh2J3cUgP9pXsMARWO00r3/Splt1oLc7TCo="
|
||||||
|
, sops-nix-flake ? null
|
||||||
}: let
|
}: let
|
||||||
sops-install-secrets = pkgs.callPackage ./pkgs/sops-install-secrets {
|
sops-install-secrets = pkgs.callPackage ./pkgs/sops-install-secrets {
|
||||||
inherit vendorHash;
|
inherit vendorHash;
|
||||||
|
|
@ -23,6 +24,10 @@ in rec {
|
||||||
inherit vendorHash;
|
inherit vendorHash;
|
||||||
};
|
};
|
||||||
unit-tests = pkgs.callPackage ./pkgs/unit-tests.nix {};
|
unit-tests = pkgs.callPackage ./pkgs/unit-tests.nix {};
|
||||||
|
|
||||||
|
sops-nixos-doc = pkgs.callPackage ./doc.nix {
|
||||||
|
inherit sops-nix-flake;
|
||||||
|
};
|
||||||
} // (pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
|
} // (pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
|
||||||
lint = pkgs.callPackage ./pkgs/lint.nix {
|
lint = pkgs.callPackage ./pkgs/lint.nix {
|
||||||
inherit sops-install-secrets;
|
inherit sops-install-secrets;
|
||||||
|
|
|
||||||
30
doc.nix
Normal file
30
doc.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
{ nixosOptionsDoc, runCommand, fetchurl, pandoc, nixos, sops-nix-flake ? null }:
|
||||||
|
|
||||||
|
let
|
||||||
|
eval = nixos [ ./modules/sops/default.nix ];
|
||||||
|
options = nixosOptionsDoc {
|
||||||
|
options = eval.options.sops;
|
||||||
|
};
|
||||||
|
rev = if sops-nix-flake != null then sops-nix-flake.rev or "master" else "master";
|
||||||
|
|
||||||
|
md = (runCommand "options.md" { } ''
|
||||||
|
cat >$out <<EOF
|
||||||
|
# Sops-nix options
|
||||||
|
|
||||||
|
EOF
|
||||||
|
cat ${options.optionsCommonMark} >>$out
|
||||||
|
sed -i -e 's!\[/nix/store/.*/modules/sops/\(.*\).*!' "$out"
|
||||||
|
'').overrideAttrs (_o: {
|
||||||
|
# Work around https://github.com/hercules-ci/hercules-ci-agent/issues/168
|
||||||
|
allowSubstitutes = true;
|
||||||
|
});
|
||||||
|
css = fetchurl {
|
||||||
|
url = "https://gist.githubusercontent.com/killercup/5917178/raw/40840de5352083adb2693dc742e9f75dbb18650f/pandoc.css";
|
||||||
|
sha256 = "sha256-SzSvxBIrylxBF6B/mOImLlZ+GvCfpWNLzGFViLyOeTk=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
runCommand "sops.html" { nativeBuildInputs = [ pandoc ]; } ''
|
||||||
|
mkdir $out
|
||||||
|
cp ${css} $out/pandoc.css
|
||||||
|
pandoc --css="pandoc.css" ${md} --to=html5 -s -f markdown+smart --metadata pagetitle="Sops options" -o $out/index.html
|
||||||
|
''
|
||||||
|
|
@ -35,12 +35,14 @@
|
||||||
packages = forAllSystems (system:
|
packages = forAllSystems (system:
|
||||||
import ./default.nix {
|
import ./default.nix {
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {inherit system;};
|
||||||
|
sops-nix-flake = self;
|
||||||
});
|
});
|
||||||
checks = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux"]
|
checks = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux"]
|
||||||
(system: let
|
(system: let
|
||||||
tests = self.packages.${system}.sops-install-secrets.tests;
|
tests = self.packages.${system}.sops-install-secrets.tests;
|
||||||
packages-stable = import ./default.nix {
|
packages-stable = import ./default.nix {
|
||||||
pkgs = import nixpkgs-stable {inherit system;};
|
pkgs = import nixpkgs-stable {inherit system;};
|
||||||
|
sops-nix-flake = self;
|
||||||
};
|
};
|
||||||
tests-stable = packages-stable.sops-install-secrets.tests;
|
tests-stable = packages-stable.sops-install-secrets.tests;
|
||||||
in tests //
|
in tests //
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue