hardware.nix (593B)
1 with import <nixpkgs> { }; 2 3 let 4 inherit (builtins) stringLength readDir filter; 5 devices = filter (n: n != "families") (lib.mapAttrsToList (n: t: n) (readDir ../devices)); 6 texts = map ( 7 n: 8 let 9 d = import ../devices/${n}/default.nix; 10 tag = ".. _${lib.strings.replaceStrings [ " " ] [ "-" ] n}:"; 11 d' = { 12 description = '' 13 ${n} 14 ${substring 0 (stringLength n) "============================"} 15 ''; 16 } // d; 17 in 18 "${tag}\n\n${d'.description}" 19 ) devices; 20 in 21 writeText "hwdoc" '' 22 ${lib.concatStringsSep "\n\n" texts} 23 24 ''