From 0f268b789ceb31480254d183c5e8e4c322b9abe4 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Wed, 11 Sep 2024 14:42:55 +0100 Subject: [PATCH 1/9] feat: reload devshell when private dev flake has changed --- .envrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc b/.envrc index 1705466..89abc39 100644 --- a/.envrc +++ b/.envrc @@ -3,6 +3,7 @@ if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then fi watch_file devshell.nix +watch_file dev/private.narHash use flake From 4ef3e764cb803cf67c428207c1d62e162fb21898 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Wed, 11 Sep 2024 14:51:23 +0100 Subject: [PATCH 2/9] chore: fmt --- flake.nix | 2 +- modules/nixos/virtualisation.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 603564f..f688567 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,7 @@ ); in { - lib = import ./lib { lib = privateInputs.nixpkgs.lib; }; + lib = import ./lib { inherit (privateInputs.nixpkgs) lib; }; nixosConfigurations = { basic = diff --git a/modules/nixos/virtualisation.nix b/modules/nixos/virtualisation.nix index 9ab71a0..b21be61 100644 --- a/modules/nixos/virtualisation.nix +++ b/modules/nixos/virtualisation.nix @@ -90,7 +90,7 @@ in virtualisation = { # oracle - virtualbox.guest.enable = lib.mkIf (cfg.oracle.enable) (lib.mkDefault true); + virtualbox.guest.enable = lib.mkIf cfg.oracle.enable (lib.mkDefault true); # hyper-v hypervGuest.enable = lib.mkIf cfg.hyperv.enable (lib.mkDefault true); }; From e38e72b2834208f7ad649df074a3bb9ab95d08c5 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Wed, 11 Sep 2024 14:52:48 +0100 Subject: [PATCH 3/9] feat: add update-dev-private-narHash to devshell --- devshell.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/devshell.nix b/devshell.nix index c91f4c7..8c45bd7 100644 --- a/devshell.nix +++ b/devshell.nix @@ -1 +1,10 @@ -{ pkgs, ... }: pkgs.mkShellNoCC { packages = [ pkgs.nix-unit ]; } +{ pkgs, ... }: +pkgs.mkShellNoCC { + packages = [ + pkgs.nix-unit + (pkgs.writeScriptBin "update-dev-private-narHash" '' + nix flake lock ./dev/private + nix hash path ./dev/private | tr -d '\n' > ./dev/private.narHash + '') + ]; +} From 1cd9efc1924ba2850c62ed750e5167729cf9659a Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Wed, 11 Sep 2024 16:04:51 +0100 Subject: [PATCH 4/9] feat: bootstrap docs --- .github/workflows/gh-pages.yml | 44 +++++++ .gitignore | 3 +- devshell.nix | 2 +- docs.nix | 15 +++ docs/content/assets/images/hero.svg | 12 ++ docs/content/assets/images/logo.png | Bin 0 -> 22099 bytes docs/content/contributing/code.md | 41 ++++++ docs/content/contributing/docs.md | 68 ++++++++++ .../getting-started/generate-report.md | 78 ++++++++++++ .../getting-started/nixos-configuration.md | 93 ++++++++++++++ docs/content/index.md | 7 ++ docs/content/reference/.gitignore | 0 docs/content/stylesheets/extra.css | 0 docs/theme/home.html | 119 ++++++++++++++++++ flake.nix | 3 +- mkdocs.yml | 112 +++++++++++++++++ 16 files changed, 594 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/gh-pages.yml create mode 100644 docs.nix create mode 100644 docs/content/assets/images/hero.svg create mode 100644 docs/content/assets/images/logo.png create mode 100644 docs/content/contributing/code.md create mode 100644 docs/content/contributing/docs.md create mode 100644 docs/content/getting-started/generate-report.md create mode 100644 docs/content/getting-started/nixos-configuration.md create mode 100644 docs/content/index.md create mode 100644 docs/content/reference/.gitignore create mode 100644 docs/content/stylesheets/extra.css create mode 100644 docs/theme/home.html create mode 100644 mkdocs.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..305357b --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,44 @@ +name: Deploy docs + +on: + push: + branches: + - main + tags: + - "v*" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-22.04 + permissions: + contents: write + concurrency: + group: ${{ github.workflow }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: cachix/install-nix-action@V27 + with: + extra_nix_config: | + accept-flake-config = true + experimental-features = nix-command flakes + - name: Configure Git user + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + - name: Deploy main + if: ${{ github.ref_name == 'main' }} + run: | + nix develop .#docs --command bash -c "mike deploy -p main" + - name: Deploy version + if: startsWith(github.ref, 'refs/tags/v') + run: | + REF_NAME=${{ github.ref_name }} + MAJOR_MINOR=${REF_NAME%.*} + # strip the leading v from the ref_name + # update the latest alias + nix develop .#docs --command bash -c "mike deploy -p -u ${MAJOR_MINOR} latest" diff --git a/.gitignore b/.gitignore index 9581259..4a71ade 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ result* *.qcow2 .data -report.json \ No newline at end of file +report.json +site \ No newline at end of file diff --git a/devshell.nix b/devshell.nix index 8c45bd7..50ca928 100644 --- a/devshell.nix +++ b/devshell.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, inputs, ... }: pkgs.mkShellNoCC { packages = [ pkgs.nix-unit diff --git a/docs.nix b/docs.nix new file mode 100644 index 0000000..9a0af84 --- /dev/null +++ b/docs.nix @@ -0,0 +1,15 @@ +{ + pkgs, + ... +}: +pkgs.mkShellNoCC { + packages = + with pkgs; + [ + mkdocs + ] + ++ (with pkgs.python3Packages; [ + mike + mkdocs-material + ]); +} diff --git a/docs/content/assets/images/hero.svg b/docs/content/assets/images/hero.svg new file mode 100644 index 0000000..872bd84 --- /dev/null +++ b/docs/content/assets/images/hero.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/docs/content/assets/images/logo.png b/docs/content/assets/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a45c0a675c2c949799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45UdA;lLT`Vg2Sl~o z+8A0Ae|ZYqcoBd{^{P8~=lv4;Q}+Tj_MU>lHw zJodF7s4Qp`oGg4!140Z!?r+H#4Ppv)1ivxl$)I#hzC@_<2;`Vh00zVXQG8d>E$J;M zp(dcl`qCWaUEe4clT>aiB|EHOxoMf5%!HK>PZ6AqRH*-ISbk?;hE^Pks5Q%&Xm(^m z8W9TA?`B_CrK{No+48J#hiAjP;p1D9d#E$@txP!*Q=ZQDen&?`wts)$j9+SuRJrW6 z^Y5cA_pfr7*KPX~AubEElHizea4YQc9~6QvcwP`6ivG?PxrIEjOIA-5%OUe}17R-8 zX6vI8toigNnNX>ilsJ$ei41}QEPOR~O1VD8o?7~wG9@h;0^`4uOsD1BYJ5OrqR;+R z!waP$B{TDo+aQv@Mb+yMq=pJ|8hA)ZyL^V8-s_5JI5~Jsn=A8=s@TwJPwsbb5S&j} zJxmIy65fA&V8M4qTUO#vd3%&r5N{|((dzw!!W?p{r7(e$X0e26_g(xPya7~~TtNFv z51z#41q1nf&n0?r2Wg{t(Qz5ZlWoF)6%@h|{Zr2jvY1To-n$?qRfR<6ytX?EJa>=N zy~uA?YfJ^Y_N`yNZ4l`YLnl!FaxMj!Oa%;hZ?9Wjth%f}gs2THn8MrCuI-KO3rl)F zMedg44Bj#mIqPirvgX$25Sgu)N;ZW$Nw0Y%F~kY zP?DxyUseL7ej{HM_A#Nkyze~k58Ho<<3^j$JNsq_rV=-$!CDCO0(XR}876*Epm4QC zfVikU9cv+fej)A zMM@JP)xKDn0N20CE5l89H7YChuQAyNT*MY*2NzDT`h;!bt4FSPYbw~|m;7Lt^Dko! z9TUCHtGfI6SGgSXulW1hoUv2i&}YP2&yZY*g_Nh|?ob5i0$%KDRP=oK5$$S@c5yar zyqUsn(cfMA{qe0=&~~8>fq_iO(&D>X..` a docs version `v.` is created and the + [latest](https://numtide.github.io/nixos-facter/latest) alias is updated to point to this. + +The idea is that users will land on the latest released version of the docs by default, with `main` being available if +they wish to read about unreleased features and changes. + +To preview the versions locally you can use `mike serve` instead of `mkdocs serve`. + +!!! warning + + Be sure to have fetched the latest changes for the `gh-pages` branch first. + This is especially important if you are using `mike` locally to make manual changes to the published site. + +[Nix]: https://nixos.org +[Flake]: https://wiki.nixos.org/wiki/Flakes +[Nix derivation]: https://nix.dev/manual/nix/2.18/language/derivations +[Direnv]: https://direnv.net +[devshell]: https://nix.dev/tutorials/first-steps/declarative-shell.html +[MkDocs]: https://www.mkdocs.org/ +[MkDocs Material]: https://squidfunk.github.io/mkdocs-material/ +[Github Pages]: https://pages.github.com/ +[mike]: https://github.com/jimporter/mike diff --git a/docs/content/getting-started/generate-report.md b/docs/content/getting-started/generate-report.md new file mode 100644 index 0000000..fe2fa32 --- /dev/null +++ b/docs/content/getting-started/generate-report.md @@ -0,0 +1,78 @@ +# Generate a report + +To generate a report, you will need to have [Nix] installed on the target machine. + +```shell +sudo nix run \ + --option experimental-features "nix-command flakes" \ + --option extra-substituters https://numtide.cachix.org \ + --option extra-trusted-public-keys numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE= \ + github:numtide/nixos-facter -- -o facter.json +``` + +!!! note + + In the near-future we will add [nixos-facter] to [nixpkgs]. Until then, we recommend using the [Numtide Binary Cache] + to avoid having to build everything from scratch. + +This will scan your system and produce a JSON-based report in a file named `facter.json`: + +```json title="facter.json" +{ + "version": 2, // (1)! + "system": "x86_64-linux", // (2)! + "virtualisation": "none", // (3)! + "hardware": { // (4)! + "bios": { ... }, + "bluetooth": [ ... ], + "bridge": [ ... ], + "chip_card": [ ... ] , + "cpu": [ ... ], + "disk": [ ... ], + "graphics_card": [ ... ], + "hub": [ ... ], + "keyboard": [ ... ], + "memory": [ ... ], + "monitor": [ ... ], + "mouse": [ ... ], + "network_controller": [ ... ], + "network_interface": [ ... ], + "sound": [ ... ], + "storage_controller": [ ... ], + "system": [ ... ], + "unknown": [ ... ], + "usb_controller": [ ... ] + }, + "smbios": { // (5)! + "bios": { ... }, + "board": { ... }, + "cache": [ ... ], + "chassis": { ... }, + "config": { ... }, + "language": { ... }, + "memory_array": [ ... ], + "memory_array_mapped_address": [ ... ], + "memory_device": [ ... ], + "memory_device_mapped_address": [ ... ], + "memory_error": [ ... ], + "onboard": [ ... ], + "port_connector": [ ... ], + "processor": [ ... ], + "slot": [ ... ], + "system": { ... } + } +} +``` + +1. Used to track major breaking changes in the report format. +2. Architecture of the target machine. +3. Indicates whether the report was generated inside a virtualised environment, and if so, what type. +4. All the various bits of hardware that could be detected. +5. [System Management BIOS] information if available. + +[Nix]: https://nixos.org +[Numtide]: https://numtide.com +[Numtide Binary Cache]: https://numtide.cachix.org +[nixos-facter]: https://github.com/numtide/nixos-facter +[nixpkgs]: https://github.com/nixos/nixpkgs +[System Management BIOS]: https://wiki.osdev.org/System_Management_BIOS diff --git a/docs/content/getting-started/nixos-configuration.md b/docs/content/getting-started/nixos-configuration.md new file mode 100644 index 0000000..ecbf01f --- /dev/null +++ b/docs/content/getting-started/nixos-configuration.md @@ -0,0 +1,93 @@ +# NixOS Configuration + +Taking the `facter.json` file generated in the [previous step](./generate-report.md), we can construct a +[NixOS configuration]: + +=== "Flake" + + ```nix title="flake.nix" + { + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; + }; + + outputs = + inputs@{ nixpkgs, ... }: + let + inherit (nixpkgs) lib; + in + { + nixosConfigurations.basic = lib.nixosSystem { + modules = [ + + # enable the NixOS Facter module + inputs.nixos-facter-modules.nixosModules.facter + + # configure the facter report + { config.facter.reportPath = ./facter.json; } + + # Additional modules and configuration, for example: + # + # { + # users.users.root.initialPassword = "fnord23"; + # boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; + # fileSystems."/".device = lib.mkDefault "/dev/sda"; + # } + # ... + # Define your bootloader if you are not using grub + # { boot.loader.systemd-boot.enable = true; } + ]; + }; + }; + } + ``` + +=== "Non-Flake" + + ```nix title="configuration.nix" + { lib, ... }: + { + imports = [ + "${ + (builtins.fetchTarball { url = "https://github.com/numtide/nixos-facter-modules/"; }) + }/modules/nixos/facter.nix" + ]; + + # configure the facter report + config.facter.reportPath = ./facter.json; + + # Additional modules and configuration, for example: + # + # config.users.users.root.initialPassword = "fnord23"; + # config.boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; + # config.fileSystems."/".device = lib.mkDefault "/dev/sda"; + # + # ... + # Define your bootloader if you are not using grub + # config.boot.loader.systemd-boot.enable = true; + } + ``` + +The NixOS Facter module will attempt to do the following: + +- Configure `nixpkgs.hostPlatform` based on the [detected architecture]. +- Enable a variety of kernel modules and NixOS options related to VM and bare-metal environments based on the [detected virtualisation]. +- Enable CPU microcode updates based on the [detected CPU(s)]. +- Ensure a variety of kernel modules are made available at boot time based on the [detected (usb|firewire|storage) controllers and disks]. +- Enable a variety of kernel modules based on the [detected Broadcom and Intel WiFi devices]. + +!!! info "Roadmap" + + We continue to add to and improve [nixos-facter-modules]. Our eventual goal is to replace much if not all of the + functionality currently provided by [nixos-hardware] and [nixos-generate-config]. + +[NixOS configuration]: https://nixos.org/manual/nixos/stable/#sec-configuration-syntax +[detected architecture]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/system.nix +[detected virtualisation]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/virtualisation.nix +[detected CPU(s)]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/firmware.nix +[detected (usb|firewire|storage) controllers and disks]: (https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/boot.nix) +[detected Broadcom and Intel WiFi devices]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/networking +[nixos-facter-modules]: https://github.com/numtide/nixos-facter-modules +[nixos-hardware]: https://github.com/NixOS/nixos-hardware +[nixos-generate-config]: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/tools/nixos-generate-config.pl diff --git a/docs/content/index.md b/docs/content/index.md new file mode 100644 index 0000000..6bd609c --- /dev/null +++ b/docs/content/index.md @@ -0,0 +1,7 @@ +--- +template: home.html +search: + exclude: true +--- + +# Home diff --git a/docs/content/reference/.gitignore b/docs/content/reference/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/docs/content/stylesheets/extra.css b/docs/content/stylesheets/extra.css new file mode 100644 index 0000000..e69de29 diff --git a/docs/theme/home.html b/docs/theme/home.html new file mode 100644 index 0000000..d3b6434 --- /dev/null +++ b/docs/theme/home.html @@ -0,0 +1,119 @@ +{% extends "main.html" %} {% block header %} +
+ +
+{% endblock %} {% block hero %} + + +
+
+
+
+

NixOS Facter Modules

+

{{ config.site_description }}

+ + Get started + + + Contribute + +
+ +
+ +
+
+
+
+{% endblock %} {% block tabs %}{% endblock %} {% block site_nav %}{% endblock %} +{% block content %}{% endblock %} {% block footer %}{% endblock %} diff --git a/flake.nix b/flake.nix index f688567..29a063e 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,8 @@ devShells = eachSystem ( { pkgs, ... }: { - default = pkgs.callPackage ./devshell.nix { }; + default = pkgs.callPackage ./devshell.nix { inputs = publicInputs // privateInputs; }; + docs = pkgs.callPackage ./docs.nix { }; } ); formatter = eachSystem ( diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..a9fb4c9 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,112 @@ +# Project info +site_name: NixOS Facter Modules +site_url: https://numtide.github.io/nixos-facter-modules +site_description: >- + NixOS Modules for use with NixOS Facter + +# Repository +repo_name: numtide/nixos-facter-modules +repo_url: https://github.com/numtide/nixos-facter-modules + +# Copyright +copyright: >- + Content on this site is licensed under a Creative Commons + Attribution-ShareAlike 4.0 International license. + +validation: + omitted_files: warn + absolute_links: warn + unrecognized_links: warn + +# Configuration + +docs_dir: docs/content + +nav: + +theme: + name: material + custom_dir: docs/theme + + logo: assets/images/logo.png + favicon: assets/images/logo.png + + features: + - content.code.annotate + - content.code.copy + - navigation.footer + - navigation.indexes + - navigation.path + - navigation.sections + - navigation.tabs + - navigation.tracking + - search.highlight + - search.share + - search.suggest + + font: + text: Inter + mono: Noto Sans Mono + palette: + # Palette toggle for automatic mode + - media: "(prefers-color-scheme)" + toggle: + icon: material/brightness-auto + name: Switch to light mode + + # Palette toggle for light mode + - media: "(prefers-color-scheme: light)" + scheme: default + toggle: + icon: material/brightness-7 + name: Switch to dark mode + + # Palette toggle for dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/brightness-4 + name: Switch to system preference + +extra: + version: + provider: mike + social: + - icon: fontawesome/brands/github + link: https://github.com/numtide + - icon: fontawesome/brands/x-twitter + link: https://x.com/numtide + - icon: fontawesome/brands/mastodon + link: https://fosstodon.org/@numtide + +extra_css: + - stylesheets/extra.css + +markdown_extensions: + - tables + - admonition + - attr_list + - footnotes + - md_in_html + - def_list + - meta + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true + - pymdownx.details + - pymdownx.highlight: + use_pygments: true + linenums: true + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.keys + +plugins: + - search + - mike From fbb95f88cba65e2bccbd4cf87aae3239312c8d69 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Wed, 11 Sep 2024 16:29:09 +0100 Subject: [PATCH 5/9] fix: bluetooth module It wasn't handling the case where no bluetooth entries were detected. --- modules/nixos/bluetooth.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/nixos/bluetooth.nix b/modules/nixos/bluetooth.nix index 9c44c72..84452b9 100644 --- a/modules/nixos/bluetooth.nix +++ b/modules/nixos/bluetooth.nix @@ -6,7 +6,11 @@ let in { options.facter.bluetooth.enable = lib.mkEnableOption "Enable the Facter bluetooth module" // { - default = builtins.length report.hardware.bluetooth > 0; + default = + let + bluetooth = report.hardware.bluetooth or [ ]; + in + builtins.length bluetooth > 0; }; config = From 14a6de71be39442241990cf60ddfe6d3c525e1da Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 12 Sep 2024 11:39:27 +0100 Subject: [PATCH 6/9] feat: improve NixOS Options reference generation --- devshell.nix | 2 +- docs.nix | 67 +- docs/content/reference/.gitignore | 1 + flake.nix | 2 +- hosts/basic/report.json | 1173 +++++++++++++---------------- 5 files changed, 592 insertions(+), 653 deletions(-) diff --git a/devshell.nix b/devshell.nix index 50ca928..8c45bd7 100644 --- a/devshell.nix +++ b/devshell.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: +{ pkgs, ... }: pkgs.mkShellNoCC { packages = [ pkgs.nix-unit diff --git a/docs.nix b/docs.nix index 9a0af84..e063720 100644 --- a/docs.nix +++ b/docs.nix @@ -4,9 +4,74 @@ }: pkgs.mkShellNoCC { packages = + let + inherit (pkgs) lib; + + # Eval NixOS modules + eval = lib.evalModules { + modules = [ + # Load the root module + ./modules/nixos/facter.nix + { + # Disable checks so it doesn't complain about NixOS related options which aren't available + config._module.check = false; + # Use the basic vm's report + config.facter.reportPath = ./hosts/basic/report.json; + } + ]; + }; + + # Capture root so we can identify our store paths below + root = toString ./.; + + # Convert `/nix/store/...` store paths in the option declarations into a repository link. + # NOTE: we point at the main branch, but for versioned docs this will be incorrect. + # It's still a good starting point though. + transformDeclaration = + decl: + let + declStr = toString decl; + subpath = lib.removePrefix "/" (lib.removePrefix root declStr); + in + assert lib.hasPrefix root declStr; + { + url = "https://github.com/numtide/nixos-facter-modules/blob/main/${subpath}"; + name = subpath; + }; + + # For each key in `options.facter` we generate it's own separate markdown file and then symlink join them together + # into a common directory. + optionsDoc = pkgs.symlinkJoin { + name = "facter-module-docs"; + paths = lib.mapAttrsToList ( + name: value: + let + optionsDoc = pkgs.nixosOptionsDoc { + options = value; + transformOptions = + opt: + opt + // { + declarations = map transformDeclaration opt.declarations; + }; + }; + in + pkgs.runCommand "${name}-doc" { } '' + mkdir $out + cat ${optionsDoc.optionsCommonMark} > $out/${name}.md + '' + ) eval.options.facter; + }; + in with pkgs; [ - mkdocs + (pkgs.writeScriptBin "mkdocs" '' + # rsync in NixOS modules doc to avoid issues with symlinks being owned by root + rsync -aL ${optionsDoc}/ ./docs/content/reference/nixos_modules + + # execute the underlying command + ${pkgs.mkdocs}/bin/mkdocs "$@" + '') ] ++ (with pkgs.python3Packages; [ mike diff --git a/docs/content/reference/.gitignore b/docs/content/reference/.gitignore index e69de29..83e1133 100644 --- a/docs/content/reference/.gitignore +++ b/docs/content/reference/.gitignore @@ -0,0 +1 @@ +nixos_modules \ No newline at end of file diff --git a/flake.nix b/flake.nix index 29a063e..75187b2 100644 --- a/flake.nix +++ b/flake.nix @@ -59,7 +59,7 @@ { pkgs, ... }: { default = pkgs.callPackage ./devshell.nix { inputs = publicInputs // privateInputs; }; - docs = pkgs.callPackage ./docs.nix { }; + docs = pkgs.callPackage ./docs.nix { inputs = publicInputs // privateInputs; }; } ); formatter = eachSystem ( diff --git a/hosts/basic/report.json b/hosts/basic/report.json index 9e0a467..1b0bde4 100644 --- a/hosts/basic/report.json +++ b/hosts/basic/report.json @@ -24,41 +24,35 @@ "bridge": [ { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 1, "base_class": { - "value": 6, - "name": "Bridge" + "name": "Bridge", + "value": 6 }, "sub_class": { - "value": 1, - "name": "ISA bridge" + "name": "ISA bridge", + "value": 1 }, "vendor": { - "type": "pci", - "value": 32902, - "name": "Intel Corporation" + "name": "Intel Corporation", + "value": 32902 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 28672, - "name": "82371SB PIIX3 ISA [Natoma/Triton II]" + "value": 28672 }, "sub_device": { - "type": "pci", - "value": 4352, - "name": "Qemu virtual machine" + "value": 4352 }, - "model": "Red Hat Qemu virtual machine", + "model": "Intel ISA bridge", "sysfs_id": "/devices/pci0000:00/0000:00:01.0", "sysfs_bus_id": "0000:00:01.0", + "sysfs_iommu_group_id": 0, "detail": { "function": 0, "command": 259, @@ -74,44 +68,38 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 0, "base_class": { - "value": 6, - "name": "Bridge" + "name": "Bridge", + "value": 6 }, "sub_class": { - "value": 0, - "name": "Host bridge" + "name": "Host bridge", + "value": 0 }, "vendor": { - "type": "pci", - "value": 32902, - "name": "Intel Corporation" + "name": "Intel Corporation", + "value": 32902 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4663, - "name": "440FX - 82441FX PMC [Natoma]" + "value": 4663 }, "sub_device": { - "type": "pci", - "value": 4352, - "name": "Qemu virtual machine" + "value": 4352 }, "revision": { "value": 2 }, - "model": "Red Hat Qemu virtual machine", + "model": "Intel Host bridge", "sysfs_id": "/devices/pci0000:00/0000:00:00.0", "sysfs_bus_id": "0000:00:00.0", + "sysfs_iommu_group_id": 0, "detail": { "function": 0, "command": 259, @@ -127,44 +115,38 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 1, "base_class": { - "value": 6, - "name": "Bridge" + "name": "Bridge", + "value": 6 }, "sub_class": { - "value": 128, - "name": "Bridge" + "name": "Bridge", + "value": 128 }, "vendor": { - "type": "pci", - "value": 32902, - "name": "Intel Corporation" + "name": "Intel Corporation", + "value": 32902 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 28947, - "name": "82371AB/EB/MB PIIX4 ACPI" + "value": 28947 }, "sub_device": { - "type": "pci", - "value": 4352, - "name": "Qemu virtual machine" + "value": 4352 }, "revision": { "value": 3 }, - "model": "Red Hat Qemu virtual machine", + "model": "Intel Bridge", "sysfs_id": "/devices/pci0000:00/0000:00:01.3", "sysfs_bus_id": "0000:00:01.3", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "irq", @@ -198,39 +180,40 @@ "cdrom": [ { "bus_type": { - "value": 132, - "name": "SCSI" + "name": "SCSI", + "value": 132 }, "slot": 256, "base_class": { - "value": 262, - "name": "Mass Storage Device" + "name": "Mass Storage Device", + "value": 262 }, "sub_class": { - "value": 2, - "name": "CD-ROM" + "name": "CD-ROM", + "value": 2 }, "pci_interface": { - "value": 3, - "name": "DVD" + "name": "DVD", + "value": 3 }, "vendor": { - "value": 0, - "name": "QEMU" + "name": "QEMU", + "value": 0 }, "device": { - "value": 0, - "name": "QEMU DVD-ROM" + "name": "QEMU DVD-ROM", + "value": 0 }, "revision": { - "value": 0, - "name": "2.5+" + "name": "2.5+", + "value": 0 }, "model": "QEMU DVD-ROM", "attached_to": 14, "sysfs_id": "/class/block/sr0", "sysfs_bus_id": "1:0:0:0", "sysfs_device_link": "/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0/1:0:0:0", + "sysfs_iommu_group_id": 0, "unix_device_name": "/dev/sr0", "unix_device_number": { "type": 98, @@ -238,6 +221,21 @@ "minor": 0, "range": 1 }, + "unix_device_names": [ + "/dev/cdrom", + "/dev/disk/by-diskseq/3", + "/dev/disk/by-id/ata-QEMU_DVD-ROM_QM00003", + "/dev/disk/by-path/pci-0000:00:01.1-ata-2", + "/dev/disk/by-path/pci-0000:00:01.1-ata-2.0", + "/dev/sr0" + ], + "unix_device_name_2": "/dev/sg0", + "unix_device_number_2": { + "type": 99, + "major": 21, + "minor": 0, + "range": 1 + }, "hotplug": "none", "hotplug_slot": 0, "is": { @@ -379,7 +377,7 @@ "spec_store_bypass", "srso" ], - "bogo": 6800, + "bogo": 6799.99, "cache": 512, "units": 2, "physical_id": 0, @@ -402,17 +400,18 @@ { "slot": 0, "base_class": { - "value": 262, - "name": "Mass Storage Device" + "name": "Mass Storage Device", + "value": 262 }, "sub_class": { - "value": 0, - "name": "Disk" + "name": "Disk", + "value": 0 }, "model": "Disk", "sysfs_id": "/class/block/fd0", "sysfs_bus_id": "floppy.0", "sysfs_device_link": "/devices/platform/floppy.0", + "sysfs_iommu_group_id": 0, "unix_device_name": "/dev/fd0", "unix_device_number": { "type": 98, @@ -420,6 +419,9 @@ "minor": 0, "range": 1 }, + "unix_device_names": [ + "/dev/fd0" + ], "resources": [ { "type": "size", @@ -445,18 +447,19 @@ { "slot": 0, "base_class": { - "value": 262, - "name": "Mass Storage Device" + "name": "Mass Storage Device", + "value": 262 }, "sub_class": { - "value": 0, - "name": "Disk" + "name": "Disk", + "value": 0 }, "model": "Disk", "attached_to": 21, "sysfs_id": "/class/block/vda", "sysfs_bus_id": "virtio6", "sysfs_device_link": "/devices/pci0000:00/0000:00:09.0/virtio6", + "sysfs_iommu_group_id": 0, "unix_device_name": "/dev/vda", "unix_device_number": { "type": 98, @@ -464,6 +467,15 @@ "minor": 0, "range": 16 }, + "unix_device_names": [ + "/dev/disk/by-diskseq/1", + "/dev/disk/by-id/virtio-root", + "/dev/disk/by-label/nixos", + "/dev/disk/by-path/pci-0000:00:09.0", + "/dev/disk/by-path/virtio-pci-0000:00:09.0", + "/dev/disk/by-uuid/d907ce0d-0d9b-446f-8f2e-6b0bd67873f1", + "/dev/vda" + ], "resources": [ { "type": "disk_geo", @@ -490,45 +502,40 @@ "virtio_blk" ], "driver_modules": [ - "virtio_pci", - "virtio_blk" + "virtio_blk", + "virtio_pci" ] } ], "graphics_card": [ { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 2, "base_class": { - "value": 3, - "name": "Display controller" + "name": "Display controller", + "value": 3 }, "sub_class": { - "value": 0, - "name": "VGA compatible controller" + "name": "VGA compatible controller", + "value": 0 }, "pci_interface": { - "value": 0, - "name": "VGA" + "name": "VGA", + "value": 0 }, "vendor": { - "type": "pci", "value": 4660 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", "value": 4369 }, "sub_device": { - "type": "pci", "value": 4352 }, "revision": { @@ -537,6 +544,7 @@ "model": "VGA compatible controller", "sysfs_id": "/devices/pci0000:00/0000:00:02.0", "sysfs_bus_id": "0000:00:02.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "mem", @@ -588,32 +596,31 @@ "hub": [ { "bus_type": { - "value": 134, - "name": "USB" + "name": "USB", + "value": 134 }, "slot": 0, "base_class": { - "value": 266, - "name": "Hub" + "name": "Hub", + "value": 266 }, "vendor": { - "type": "usb", - "value": 7531, - "name": "Linux Foundation" + "name": "Linux 6.6.48 uhci_hcd", + "value": 7531 }, "device": { - "type": "usb", - "value": 1, - "name": "1.1 root hub" + "name": "UHCI Host Controller", + "value": 1 }, "revision": { - "value": 0, - "name": "6.06" + "name": "6.06", + "value": 0 }, - "model": "Linux Foundation 1.1 root hub", + "model": "Linux 6.6.48 uhci_hcd UHCI Host Controller", "attached_to": 7, "sysfs_id": "/devices/pci0000:00/0000:00:01.2/usb1/1-0:1.0", "sysfs_bus_id": "1-0:1.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "baud", @@ -635,7 +642,7 @@ "used_connections": 0, "interface_descriptor": 0, "speed": 12000000, - "manufacturer": "Linux 6.6.45 uhci_hcd", + "manufacturer": "Linux 6.6.48 uhci_hcd", "product": "UHCI Host Controller", "device_class": "hub", "interface_class": "hub", @@ -658,71 +665,70 @@ { "slot": 0, "base_class": { - "value": 256, - "name": "Monitor" + "name": "Monitor", + "value": 256 }, "sub_class": { - "value": 2, - "name": "LCD Monitor" + "name": "LCD Monitor", + "value": 2 }, "vendor": { - "type": "eisa", "value": 18708 }, "device": { - "type": "eisa", - "value": 4660, - "name": "QEMU Monitor" + "name": "QEMU Monitor", + "value": 4660 }, "model": "QEMU Monitor", "attached_to": 17, + "sysfs_iommu_group_id": 0, "resources": [ { "type": "monitor", - "width": 640, - "height": 480, + "width": 1024, + "height": 768, "vertical_frequency": 60, "interlaced": false }, { "type": "monitor", - "width": 800, - "height": 600, + "width": 1280, + "height": 800, "vertical_frequency": 60, "interlaced": false }, { "type": "monitor", - "width": 1024, - "height": 768, + "width": 1600, + "height": 1200, "vertical_frequency": 60, "interlaced": false }, { "type": "monitor", - "width": 2048, - "height": 1152, + "width": 1920, + "height": 1080, "vertical_frequency": 60, "interlaced": false }, { "type": "monitor", - "width": 1920, - "height": 1080, + "width": 2048, + "height": 1152, "vertical_frequency": 60, "interlaced": false }, { "type": "monitor", - "width": 1600, - "height": 1200, + "width": 640, + "height": 480, "vertical_frequency": 60, "interlaced": false }, { "type": "monitor", - "width": 1280, - "height": 800, + "width": 800, + "height": 600, "vertical_frequency": 60, "interlaced": false }, @@ -802,42 +808,33 @@ "mouse": [ { "bus_type": { - "value": 134, - "name": "USB" + "name": "USB", + "value": 134 }, "slot": 0, "base_class": { - "value": 261, - "name": "Mouse" + "name": "Mouse", + "value": 261 }, "sub_class": { - "value": 3, - "name": "USB Mouse" + "name": "USB Mouse", + "value": 3 }, "vendor": { - "type": "usb", - "value": 1575, - "name": "Adomax Technology Co., Ltd" + "name": "QEMU", + "value": 1575 }, "device": { - "type": "usb", - "value": 1, - "name": "QEMU Tablet" - }, - "compat_vendor": { - "type": "special", - "value": 512, - "name": "Unknown" - }, - "compat_device": { - "type": "special", - "value": 1, - "name": "Generic USB Mouse" + "name": "QEMU USB Tablet", + "value": 1 }, - "model": "Adomax QEMU Tablet", + "compat_vendor": "Unknown", + "compat_device": "Generic USB Mouse", + "model": "QEMU USB Tablet", "attached_to": 33, "sysfs_id": "/devices/pci0000:00/0000:00:01.2/usb1/1-1/1-1:1.0", "sysfs_bus_id": "1-1:1.0", + "sysfs_iommu_group_id": 0, "unix_device_name": "/dev/input/mice", "unix_device_number": { "type": 99, @@ -845,6 +842,9 @@ "minor": 63, "range": 1 }, + "unix_device_names": [ + "/dev/input/mice" + ], "unix_device_name_2": "/dev/input/mouse0", "unix_device_number_2": { "type": 99, @@ -906,33 +906,29 @@ "network_controller": [ { "bus_type": { - "value": 143, - "name": "Virtio" + "name": "Virtio", + "value": 143 }, "slot": 0, "base_class": { - "value": 2, - "name": "Network controller" + "name": "Network controller", + "value": 2 }, "sub_class": { - "value": 0, - "name": "Ethernet controller" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 1, - "name": "Ethernet Card 0" + "name": "Ethernet controller", + "value": 0 }, + "vendor": "Virtio", + "device": "Ethernet Card 0", "model": "Virtio Ethernet Card 0", "attached_to": 13, "sysfs_id": "/devices/pci0000:00/0000:00:03.0/virtio0", "sysfs_bus_id": "virtio0", + "sysfs_iommu_group_id": 0, "unix_device_name": "eth0", + "unix_device_names": [ + "eth0" + ], "resources": [ { "type": "hwaddr", @@ -941,10 +937,6 @@ { "type": "phwaddr", "address": 53 - }, - { - "Type": "link", - "connected": true } ], "hotplug": "none", @@ -965,18 +957,43 @@ { "slot": 0, "base_class": { - "value": 263, - "name": "Network Interface" + "name": "Network Interface", + "value": 263 }, "sub_class": { - "value": 1, - "name": "Ethernet" + "name": "Loopback", + "value": 0 + }, + "model": "Loopback network interface", + "sysfs_id": "/class/net/lo", + "sysfs_iommu_group_id": 0, + "unix_device_name": "lo", + "unix_device_names": [ + "lo" + ], + "hotplug": "none", + "hotplug_slot": 0, + "is": {} + }, + { + "slot": 0, + "base_class": { + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "name": "Ethernet", + "value": 1 }, "model": "Ethernet network interface", "attached_to": 24, "sysfs_id": "/class/net/eth0", "sysfs_device_link": "/devices/pci0000:00/0000:00:03.0/virtio0", + "sysfs_iommu_group_id": 0, "unix_device_name": "eth0", + "unix_device_names": [ + "eth0" + ], "resources": [ { "type": "hwaddr", @@ -985,10 +1002,6 @@ { "type": "phwaddr", "address": 53 - }, - { - "Type": "link", - "connected": true } ], "hotplug": "none", @@ -1002,106 +1015,76 @@ "driver_modules": [ "virtio_net" ] - }, - { - "slot": 0, - "base_class": { - "value": 263, - "name": "Network Interface" - }, - "sub_class": { - "value": 0, - "name": "Loopback" - }, - "model": "Loopback network interface", - "sysfs_id": "/class/net/lo", - "unix_device_name": "lo", - "resources": [ - { - "Type": "link", - "connected": true - } - ], - "hotplug": "none", - "hotplug_slot": 0, - "is": {} } ], "storage_controller": [ { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 1, "base_class": { - "value": 1, - "name": "Mass storage controller" + "name": "Mass storage controller", + "value": 1 }, "sub_class": { - "value": 1, - "name": "IDE interface" + "name": "IDE interface", + "value": 1 }, "pci_interface": { - "value": 128, - "name": "ISA Compatibility mode-only controller, supports bus mastering" + "value": 128 }, "vendor": { - "type": "pci", - "value": 32902, - "name": "Intel Corporation" + "name": "Intel Corporation", + "value": 32902 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 28688, - "name": "82371SB PIIX3 IDE [Natoma/Triton II]" + "value": 28688 }, "sub_device": { - "type": "pci", - "value": 4352, - "name": "Qemu virtual machine" + "value": 4352 }, - "model": "Red Hat Qemu virtual machine", + "model": "Intel IDE interface", "sysfs_id": "/devices/pci0000:00/0000:00:01.1", "sysfs_bus_id": "0000:00:01.1", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", - "base": 496, - "range": 8, + "base": 1014, + "range": 1, "enabled": true, "access": "read_write" }, { "type": "io", - "base": 1014, - "range": 1, + "base": 368, + "range": 8, "enabled": true, "access": "read_write" }, { "type": "io", - "base": 368, - "range": 8, + "base": 49536, + "range": 16, "enabled": true, "access": "read_write" }, { "type": "io", - "base": 886, - "range": 1, + "base": 496, + "range": 8, "enabled": true, "access": "read_write" }, { "type": "io", - "base": 49536, - "range": 16, + "base": 886, + "range": 1, "enabled": true, "access": "read_write" } @@ -1129,32 +1112,25 @@ }, { "bus_type": { - "value": 143, - "name": "Virtio" + "name": "Virtio", + "value": 143 }, "slot": 0, "base_class": { - "value": 1, - "name": "Mass storage controller" + "name": "Mass storage controller", + "value": 1 }, "sub_class": { - "value": 128, - "name": "Storage controller" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 2, - "name": "Storage 0" + "name": "Storage controller", + "value": 128 }, + "vendor": "Virtio", + "device": "Storage 0", "model": "Virtio Storage 0", "attached_to": 16, "sysfs_id": "/devices/pci0000:00/0000:00:09.0/virtio6", "sysfs_bus_id": "virtio6", + "sysfs_iommu_group_id": 0, "hotplug": "none", "hotplug_slot": 0, "is": {}, @@ -1175,39 +1151,33 @@ "unknown": [ { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 8, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { "value": 2 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4105, - "name": "Virtio filesystem" + "value": 4105 }, "sub_device": { - "type": "pci", "value": 9 }, - "model": "Red Hat Virtio filesystem", + "model": "Unclassified device", "sysfs_id": "/devices/pci0000:00/0000:00:08.0", "sysfs_bus_id": "0000:00:08.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -1217,12 +1187,10 @@ "access": "read_write" }, { - "type": "mem", - "base": 4273823744, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 11, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1233,10 +1201,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 11, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273823744, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1262,39 +1232,33 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 4, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { "value": 255 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4101, - "name": "Virtio RNG" + "value": 4101 }, "sub_device": { - "type": "pci", "value": 4 }, - "model": "Red Hat Virtio RNG", + "model": "Unclassified device", "sysfs_id": "/devices/pci0000:00/0000:00:04.0", "sysfs_bus_id": "0000:00:04.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -1304,12 +1268,10 @@ "access": "read_write" }, { - "type": "mem", - "base": 4273807360, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 11, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1320,10 +1282,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 11, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273807360, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1349,39 +1313,33 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 7, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { "value": 2 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4105, - "name": "Virtio filesystem" + "value": 4105 }, "sub_device": { - "type": "pci", "value": 9 }, - "model": "Red Hat Virtio filesystem", + "model": "Unclassified device", "sysfs_id": "/devices/pci0000:00/0000:00:07.0", "sysfs_bus_id": "0000:00:07.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -1391,12 +1349,10 @@ "access": "read_write" }, { - "type": "mem", - "base": 4273819648, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 10, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1407,10 +1363,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 10, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273819648, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1436,40 +1394,34 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 3, "base_class": { - "value": 2, - "name": "Network controller" + "name": "Network controller", + "value": 2 }, "sub_class": { - "value": 0, - "name": "Ethernet controller" + "name": "Ethernet controller", + "value": 0 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4096, - "name": "Virtio network device" + "value": 4096 }, "sub_device": { - "type": "pci", "value": 1 }, - "model": "Red Hat Virtio network device", + "model": "Ethernet controller", "sysfs_id": "/devices/pci0000:00/0000:00:03.0", "sysfs_bus_id": "0000:00:03.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -1479,12 +1431,10 @@ "access": "read_write" }, { - "type": "mem", - "base": 4273803264, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 10, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1503,10 +1453,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 10, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273803264, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1532,39 +1484,33 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 6, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { "value": 2 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4105, - "name": "Virtio filesystem" + "value": 4105 }, "sub_device": { - "type": "pci", "value": 9 }, - "model": "Red Hat Virtio filesystem", + "model": "Unclassified device", "sysfs_id": "/devices/pci0000:00/0000:00:06.0", "sysfs_bus_id": "0000:00:06.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -1574,12 +1520,10 @@ "access": "read_write" }, { - "type": "mem", - "base": 4273815552, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 11, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1590,10 +1534,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 11, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273815552, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1619,40 +1565,34 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 9, "base_class": { - "value": 1, - "name": "Mass storage controller" + "name": "Mass storage controller", + "value": 1 }, "sub_class": { - "value": 0, - "name": "SCSI storage controller" + "name": "SCSI storage controller", + "value": 0 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4097, - "name": "Virtio block device" + "value": 4097 }, "sub_device": { - "type": "pci", "value": 2 }, - "model": "Red Hat Virtio block device", + "model": "SCSI storage controller", "sysfs_id": "/devices/pci0000:00/0000:00:09.0", "sysfs_bus_id": "0000:00:09.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -1662,12 +1602,10 @@ "access": "read_write" }, { - "type": "mem", - "base": 4273827840, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 10, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1678,10 +1616,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 10, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273827840, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1707,39 +1647,33 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 5, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { "value": 2 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4105, - "name": "Virtio filesystem" + "value": 4105 }, "sub_device": { - "type": "pci", "value": 9 }, - "model": "Red Hat Virtio filesystem", + "model": "Unclassified device", "sysfs_id": "/devices/pci0000:00/0000:00:05.0", "sysfs_bus_id": "0000:00:05.0", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -1749,12 +1683,10 @@ "access": "read_write" }, { - "type": "mem", - "base": 4273811456, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 10, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1765,10 +1697,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 10, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273811456, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1794,51 +1728,43 @@ }, { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 10, "base_class": { - "value": 9, - "name": "Input device controller" + "name": "Input device controller", + "value": 9 }, "sub_class": { - "value": 0, - "name": "Keyboard controller" + "name": "Keyboard controller", + "value": 0 }, "vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 4178, - "name": "Virtio 1.0 input" + "value": 4178 }, "sub_device": { - "type": "pci", "value": 4352 }, "revision": { "value": 1 }, - "model": "Red Hat Virtio 1.0 input", + "model": "Keyboard controller", "sysfs_id": "/devices/pci0000:00/0000:00:0a.0", "sysfs_bus_id": "0000:00:0a.0", + "sysfs_iommu_group_id": 0, "resources": [ { - "type": "mem", - "base": 4273831936, - "range": 4096, - "enabled": true, - "access": "read_write", - "prefetch": "no" + "type": "irq", + "base": 11, + "triggered": 0, + "enabled": true }, { "type": "mem", @@ -1849,10 +1775,12 @@ "prefetch": "no" }, { - "type": "irq", - "base": 11, - "triggered": 0, - "enabled": true + "type": "mem", + "base": 4273831936, + "range": 4096, + "enabled": true, + "access": "read_write", + "prefetch": "no" } ], "detail": { @@ -1879,26 +1807,20 @@ { "slot": 0, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { - "value": 0, - "name": "Unclassified device" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 4 + "name": "Unclassified device", + "value": 0 }, + "vendor": "Virtio", + "device": "", "model": "Virtio Unclassified device", "attached_to": 9, "sysfs_id": "/devices/pci0000:00/0000:00:04.0/virtio1", "sysfs_bus_id": "virtio1", + "sysfs_iommu_group_id": 0, "hotplug": "none", "hotplug_slot": 0, "is": {}, @@ -1915,26 +1837,20 @@ { "slot": 0, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { - "value": 0, - "name": "Unclassified device" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 9 + "name": "Unclassified device", + "value": 0 }, + "vendor": "Virtio", + "device": "", "model": "Virtio Unclassified device", "attached_to": 10, "sysfs_id": "/devices/pci0000:00/0000:00:07.0/virtio4", "sysfs_bus_id": "virtio4", + "sysfs_iommu_group_id": 0, "hotplug": "none", "hotplug_slot": 0, "is": {}, @@ -1951,26 +1867,20 @@ { "slot": 0, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { - "value": 0, - "name": "Unclassified device" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 9 + "name": "Unclassified device", + "value": 0 }, + "vendor": "Virtio", + "device": "", "model": "Virtio Unclassified device", "attached_to": 18, "sysfs_id": "/devices/pci0000:00/0000:00:05.0/virtio2", "sysfs_bus_id": "virtio2", + "sysfs_iommu_group_id": 0, "hotplug": "none", "hotplug_slot": 0, "is": {}, @@ -1987,26 +1897,20 @@ { "slot": 0, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { - "value": 0, - "name": "Unclassified device" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 18 + "name": "Unclassified device", + "value": 0 }, + "vendor": "Virtio", + "device": "", "model": "Virtio Unclassified device", "attached_to": 19, "sysfs_id": "/devices/pci0000:00/0000:00:0a.0/virtio7", "sysfs_bus_id": "virtio7", + "sysfs_iommu_group_id": 0, "unix_device_name": "/dev/input/event3", "unix_device_number": { "type": 99, @@ -2014,6 +1918,10 @@ "minor": 67, "range": 1 }, + "unix_device_names": [ + "/dev/input/by-path/pci-0000:00:0a.0-event-kbd", + "/dev/input/event3" + ], "hotplug": "none", "hotplug_slot": 0, "is": {}, @@ -2030,26 +1938,20 @@ { "slot": 0, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { - "value": 0, - "name": "Unclassified device" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 9 + "name": "Unclassified device", + "value": 0 }, + "vendor": "Virtio", + "device": "", "model": "Virtio Unclassified device", "attached_to": 6, "sysfs_id": "/devices/pci0000:00/0000:00:08.0/virtio5", "sysfs_bus_id": "virtio5", + "sysfs_iommu_group_id": 0, "hotplug": "none", "hotplug_slot": 0, "is": {}, @@ -2066,26 +1968,20 @@ { "slot": 0, "base_class": { - "value": 0, - "name": "Unclassified device" + "name": "Unclassified device", + "value": 0 }, "sub_class": { - "value": 0, - "name": "Unclassified device" - }, - "vendor": { - "type": "special", - "value": 24596, - "name": "Virtio" - }, - "device": { - "type": "special", - "value": 9 + "name": "Unclassified device", + "value": 0 }, + "vendor": "Virtio", + "device": "", "model": "Virtio Unclassified device", "attached_to": 15, "sysfs_id": "/devices/pci0000:00/0000:00:06.0/virtio3", "sysfs_bus_id": "virtio3", + "sysfs_iommu_group_id": 0, "hotplug": "none", "hotplug_slot": 0, "is": {}, @@ -2102,23 +1998,27 @@ { "slot": 0, "base_class": { - "value": 7, - "name": "Communication controller" + "name": "Communication controller", + "value": 7 }, "sub_class": { - "value": 0, - "name": "Serial controller" + "name": "Serial controller", + "value": 0 }, "pci_interface": { - "value": 2, - "name": "16550" + "name": "16550", + "value": 2 }, "device": { - "value": 0, - "name": "16550A" + "name": "16550A", + "value": 0 }, "model": "16550A", + "sysfs_iommu_group_id": 0, "unix_device_name": "/dev/ttyS0", + "unix_device_names": [ + "/dev/ttyS0" + ], "resources": [ { "type": "io", @@ -2142,48 +2042,42 @@ "usb_controller": [ { "bus_type": { - "value": 4, - "name": "PCI" + "name": "PCI", + "value": 4 }, "slot": 1, "base_class": { - "value": 12, - "name": "Serial bus controller" + "name": "Serial bus controller", + "value": 12 }, "sub_class": { - "value": 3, - "name": "USB Controller" + "name": "USB Controller", + "value": 3 }, "pci_interface": { - "value": 0, - "name": "UHCI" + "name": "UHCI", + "value": 0 }, "vendor": { - "type": "pci", - "value": 32902, - "name": "Intel Corporation" + "name": "Intel Corporation", + "value": 32902 }, "sub_vendor": { - "type": "pci", - "value": 6900, - "name": "Red Hat, Inc." + "value": 6900 }, "device": { - "type": "pci", - "value": 28704, - "name": "82371SB PIIX3 USB [Natoma/Triton II]" + "value": 28704 }, "sub_device": { - "type": "pci", - "value": 4352, - "name": "QEMU Virtual Machine" + "value": 4352 }, "revision": { "value": 1 }, - "model": "Red Hat QEMU Virtual Machine", + "model": "Intel USB Controller", "sysfs_id": "/devices/pci0000:00/0000:00:01.2", "sysfs_bus_id": "0000:00:01.2", + "sysfs_iommu_group_id": 0, "resources": [ { "type": "io", @@ -2238,66 +2132,56 @@ ] }, "smbios": { - "bios": [ - { - "handle": 0, - "vendor": "SeaBIOS", - "version": "rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org", - "date": "04/01/2014", - "features": null, - "start_address": "0xe8000", - "rom_size": 65536 - } - ], - "chassis": [ - { - "handle": 768, - "manufacturer": "QEMU", - "version": "pc-i440fx-9.0", - "chassis_type": { - "value": 1, - "name": "Other" - }, - "lock_present": false, - "bootup_state": { - "value": 3, - "name": "Safe" - }, - "power_state": { - "value": 3, - "name": "Safe" - }, - "thermal_state": { - "value": 3, - "name": "Safe" - }, - "security_state": { - "value": 2, - "name": "Unknown" - }, - "oem": "0x0" - } - ], - "end_of_table": [ - { - "handle": 32512, - "data": "0x7f000000" - } - ], + "bios": { + "handle": 0, + "vendor": "SeaBIOS", + "version": "rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org", + "date": "04/01/2014", + "features": null, + "start_address": "0xe8000", + "rom_size": 65536 + }, + "chassis": { + "handle": 768, + "manufacturer": "QEMU", + "version": "pc-i440fx-9.0", + "chassis_type": { + "name": "Other", + "value": 1 + }, + "lock_present": false, + "bootup_state": { + "name": "Safe", + "value": 3 + }, + "power_state": { + "name": "Safe", + "value": 3 + }, + "thermal_state": { + "name": "Safe", + "value": 3 + }, + "security_state": { + "name": "Unknown", + "value": 2 + }, + "oem": "0x0" + }, "memory_array": [ { "handle": 4096, "location": { - "value": 1, - "name": "Other" + "name": "Other", + "value": 1 }, "usage": { - "value": 3, - "name": "System memory" + "name": "System memory", + "value": 3 }, "ecc": { - "value": 6, - "name": "Multi-bit" + "name": "Multi-bit", + "value": 6 }, "max_size": 2097152, "error_handle": 65534, @@ -2326,13 +2210,13 @@ "ecc_bits": 0, "size": 2097152, "form_factor": { - "value": 9, - "name": "DIMM" + "name": "DIMM", + "value": 9 }, "set": 0, "memory_type": { - "value": 7, - "name": "RAM" + "name": "RAM", + "value": 7 }, "memory_type_details": [ "Other" @@ -2345,52 +2229,41 @@ "handle": 1024, "socket": "CPU 0", "socket_type": { - "value": 1, - "name": "Other" + "name": "Other", + "value": 1 }, "socket_populated": true, "manufacturer": "QEMU", "version": "pc-i440fx-9.0", - "asset_tag": "", "part": "", "processor_type": { - "value": 3, - "name": "CPU" + "name": "CPU", + "value": 3 }, "processor_family": { - "value": 254, - "name": "Other" + "name": "Other", + "value": 254 }, "processor_status": { - "value": 1, - "name": "Enabled" + "name": "Enabled", + "value": 1 }, - "voltage": 0, "clock_ext": 0, "clock_max": 2000, - "clock_current": 2000, "cache_handle_l1": 0, "cache_handle_l2": 0, "cache_handle_l3": 0 } ], - "system": [ - { - "handle": 256, - "manufacturer": "QEMU", - "product": "Standard PC (i440FX + PIIX, 1996)", - "version": "pc-i440fx-9.0", - "wake_up": { - "value": 6, - "name": "Power Switch" - } - } - ], - "system_boot": [ - { - "handle": 8192, - "data": "0x20000000000031002f692f" + "system": { + "handle": 256, + "manufacturer": "QEMU", + "product": "Standard PC (i440FX + PIIX, 1996)", + "version": "pc-i440fx-9.0", + "wake_up": { + "name": "Power Switch", + "value": 6 } - ] + } } } \ No newline at end of file From 4ba0c65a4d70c1fe7a37b4e5671545cea339c3f2 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 12 Sep 2024 11:59:07 +0100 Subject: [PATCH 7/9] feat: make NixOS Modules reference markdown files snake case Ensures proper auto formatting in the nav section. --- docs.nix | 6 ++++-- modules/nixos/facter.nix | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs.nix b/docs.nix index e063720..546ac8b 100644 --- a/docs.nix +++ b/docs.nix @@ -21,6 +21,8 @@ pkgs.mkShellNoCC { ]; }; + snakeCase = with lib; replaceStrings upperChars (map (s: "_" + s) lowerChars); + # Capture root so we can identify our store paths below root = toString ./.; @@ -58,7 +60,7 @@ pkgs.mkShellNoCC { in pkgs.runCommand "${name}-doc" { } '' mkdir $out - cat ${optionsDoc.optionsCommonMark} > $out/${name}.md + cat ${optionsDoc.optionsCommonMark} > $out/${snakeCase name}.md '' ) eval.options.facter; }; @@ -67,7 +69,7 @@ pkgs.mkShellNoCC { [ (pkgs.writeScriptBin "mkdocs" '' # rsync in NixOS modules doc to avoid issues with symlinks being owned by root - rsync -aL ${optionsDoc}/ ./docs/content/reference/nixos_modules + rsync -aL --chmod=u+rw --delete-before ${optionsDoc}/ ./docs/content/reference/nixos_modules # execute the underlying command ${pkgs.mkdocs}/bin/mkdocs "$@" diff --git a/modules/nixos/facter.nix b/modules/nixos/facter.nix index bfd17d3..f74bb93 100644 --- a/modules/nixos/facter.nix +++ b/modules/nixos/facter.nix @@ -22,7 +22,7 @@ in report = mkOption { type = types.raw; default = builtins.fromJSON (builtins.readFile config.facter.reportPath); - description = "An import fo the reportPath."; + description = "An import for the reportPath."; }; reportPath = mkOption { From bafd6c636e54b61d3d6a666c68196e53bd4987a1 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 12 Sep 2024 16:34:22 +0100 Subject: [PATCH 8/9] feat: separate high level facter options doc into separate file --- docs.nix | 83 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/docs.nix b/docs.nix index 546ac8b..2c5c123 100644 --- a/docs.nix +++ b/docs.nix @@ -7,7 +7,12 @@ pkgs.mkShellNoCC { let inherit (pkgs) lib; - # Eval NixOS modules + # Capture root so we can identify our store paths below + root = toString ./.; + + snakeCase = with lib; replaceStrings upperChars (map (s: "_" + s) lowerChars); + + # Eval Facter module eval = lib.evalModules { modules = [ # Load the root module @@ -21,11 +26,6 @@ pkgs.mkShellNoCC { ]; }; - snakeCase = with lib; replaceStrings upperChars (map (s: "_" + s) lowerChars); - - # Capture root so we can identify our store paths below - root = toString ./.; - # Convert `/nix/store/...` store paths in the option declarations into a repository link. # NOTE: we point at the main branch, but for versioned docs this will be incorrect. # It's still a good starting point though. @@ -41,35 +41,62 @@ pkgs.mkShellNoCC { name = subpath; }; - # For each key in `options.facter` we generate it's own separate markdown file and then symlink join them together - # into a common directory. - optionsDoc = pkgs.symlinkJoin { - name = "facter-module-docs"; - paths = lib.mapAttrsToList ( - name: value: - let - optionsDoc = pkgs.nixosOptionsDoc { - options = value; - transformOptions = - opt: - opt - // { - declarations = map transformDeclaration opt.declarations; - }; + # Convert options into options doc, transforming declaration paths to point to the github repository. + nixosOptionsDoc = + _name: options: + pkgs.nixosOptionsDoc { + inherit options; + transformOptions = + opt: + opt + // { + declarations = map transformDeclaration opt.declarations; }; - in - pkgs.runCommand "${name}-doc" { } '' - mkdir $out - cat ${optionsDoc.optionsCommonMark} > $out/${snakeCase name}.md - '' - ) eval.options.facter; + }; + + # Take an options attr set and produce a markdown file. + mkMarkdown = + name: options: + let + optionsDoc = nixosOptionsDoc name options; + in + pkgs.runCommand "${name}-markdown" { } '' + mkdir $out + cat ${optionsDoc.optionsCommonMark} > $out/${snakeCase name}.md + ''; + + # Allows us to gather all options that are immediate children of `facter` and which have no child options. + # e.g. facter.reportPath, facter.report. + # For all other options we group them by the first immediate child of `facter`. + # e.g. facter.bluetooth, facter.boot and so on. + # This allows us to have a page for root facter options "facter.md", and a page each for the major sub modules. + facterOptionsFilter = + _: + { + loc ? [ ], + options ? [ ], + ... + }: + (lib.length loc) == 2 && ((lib.elemAt loc 0) == "facter") && (lib.length options) == 0; + + otherOptionsFilter = n: v: !(facterOptionsFilter n v); + + facterMarkdown = mkMarkdown "facter" (lib.filterAttrs facterOptionsFilter eval.options.facter); + otherMarkdown = lib.mapAttrsToList mkMarkdown ( + lib.filterAttrs otherOptionsFilter eval.options.facter + ); + + optionsMarkdown = pkgs.symlinkJoin { + name = "facter-module-markdown"; + paths = [ facterMarkdown ] ++ otherMarkdown; }; + in with pkgs; [ (pkgs.writeScriptBin "mkdocs" '' # rsync in NixOS modules doc to avoid issues with symlinks being owned by root - rsync -aL --chmod=u+rw --delete-before ${optionsDoc}/ ./docs/content/reference/nixos_modules + rsync -aL --chmod=u+rw --delete-before ${optionsMarkdown}/ ./docs/content/reference/nixos_modules # execute the underlying command ${pkgs.mkdocs}/bin/mkdocs "$@" From 5d9d8a1f1ea78a3e3bd4c56e0ca5df9d9cf24411 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 12 Sep 2024 16:43:18 +0100 Subject: [PATCH 9/9] feat: add a link to the docs in the readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index f311905..a967c23 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,12 @@ This is made possible by the hardware report provided by [NixOS Facter]. By default, these modules enable or disable themselves based on detected hardware. +For more information, see the [docs]. + [NixOS modules]: https://wiki.nixos.org/wiki/NixOS_modules [NixOS Facter]: https://github.com/numtide/nixos-facter [NixOS Hardware]: https://github.com/NixOS/nixos-hardware +[docs]: https://numtide.github.io/nixos-facter-modules ## Getting started