From 5e046490de3a7af19d5ca40d4aac7d6ff48573e8 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Thu, 9 Nov 2023 23:02:35 +0000 Subject: [PATCH] support links from device pages to their installation methods --- ci.nix | 2 +- devices/gl-ar750/default.nix | 5 +++-- doc/hardware.nix | 14 ++++++++++++-- doc/parse-options-outputs.fnl | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ci.nix b/ci.nix index d1a0e4f..ef65ad0 100644 --- a/ci.nix +++ b/ci.nix @@ -59,7 +59,7 @@ let installPhase = '' mkdir -p $out/nix-support $out/share/doc/ cd doc - cp modules-generated.rst $out + cp *-generated.rst $out ln -s ${json} $out/options.json cp -a _build/html $out/share/doc/liminix echo "file source-dist \"$out/share/doc/liminix\"" \ diff --git a/devices/gl-ar750/default.nix b/devices/gl-ar750/default.nix index 5a3fabc..c18e512 100644 --- a/devices/gl-ar750/default.nix +++ b/devices/gl-ar750/default.nix @@ -6,7 +6,7 @@ # Mainline linux 5.19 doesn't have device-tree support for this device # or even for the SoC, so we use the extensive OpenWrt kernel patches -{ +rec { system = { crossSystem = { config = "mips-unknown-linux-musl"; @@ -51,6 +51,7 @@ OpenWrt web page: https://openwrt.org/toh/gl.inet/gl-ar750 ''; + installer = "flashimage"; module = {pkgs, config, ... }: let @@ -102,7 +103,7 @@ FEATURE_DD_IBS_OBS = "y"; # ath10k_cal_data needs skip_bytes,fullblock }; hardware = { - defaultOutput = "flashimage"; + defaultOutput = installer; loadAddress = "0x80060000"; entryPoint = "0x80060000"; flash = { diff --git a/doc/hardware.nix b/doc/hardware.nix index 8f17813..bde42da 100644 --- a/doc/hardware.nix +++ b/doc/hardware.nix @@ -5,8 +5,18 @@ let builtins.readDir ../devices; texts = lib.mapAttrsToList (n: t: let d = import ../devices/${n}/default.nix; - d' = { description = "no description for ${n}"; } // d; - in d'.description ) + d' = { + description = "no description for ${n}"; + } // d; + installer = + if d ? installer + then '' + + The default installation route for this device is + :ref:`system-outputs-${d.installer}` + '' + else ""; + in (d'.description + installer)) devices; in writeText "hwdoc" '' diff --git a/doc/parse-options-outputs.fnl b/doc/parse-options-outputs.fnl index 55f0ed3..b61603c 100644 --- a/doc/parse-options-outputs.fnl +++ b/doc/parse-options-outputs.fnl @@ -7,5 +7,5 @@ (each [_ option (ipairs (yaml.load (io.read "*a")))] (when (. outputs option.name) - (print (.. ".. _" option.name) "\n") + (print (.. ".. _" (string.gsub option.name "%." "-") ":") "\n") (print option.description)))