Skip to content

Commit

Permalink
Document packages
Browse files Browse the repository at this point in the history
  • Loading branch information
barrucadu committed Oct 16, 2023
1 parent 31761ad commit 55d7a3b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ src/README.md
src/hosts.md
src/modules.md
src/options.md
src/packages.md
mdbook-admonish.css
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
- [Hosts](./hosts.md)
- [Modules](./modules.md)
- [Options](./options.md)
- [Packages](./packages.md)
1 change: 1 addition & 0 deletions packages/bookdb/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# A database and web app to keep track of all my books.
{ poetry2nix, fetchFromGitHub, ... }:

let
Expand Down
1 change: 1 addition & 0 deletions packages/bookmarks/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# A database and web app to keep track of my bookmarks.
{ poetry2nix, fetchFromGitHub, ... }:

let
Expand Down
1 change: 1 addition & 0 deletions packages/prometheus-awair-exporter/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# A simple Awair exporter for Prometheus.
{ buildGoModule, fetchFromGitHub, ... }:

buildGoModule rec {
Expand Down
1 change: 1 addition & 0 deletions packages/resolved/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# A simple DNS server for home networks.
{ rustPlatform, fetchFromGitHub, ... }:

rustPlatform.buildRustPackage rec {
Expand Down
26 changes: 26 additions & 0 deletions scripts/documentation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,32 @@ for option in sorted(options.keys()):
print("")
EOF

python3 - <<'EOF' > docs/src/packages.md
import os
print("# Packages")
print("")
packages = sorted([name for name in os.listdir("packages") if name not in [".", ".."]])
for package in packages:
source_file = f"packages/{package}/default.nix"
print(f"## {package}")
has_doc = False
with open(source_file, "r") as f:
for line in f:
if line.startswith("#"):
has_doc = True
print(line[1:].strip())
else:
break
if not has_doc:
print("This package has no description.")
print(f"\n**Declared in:** [{source_file}](https://github.com/barrucadu/nixfiles/blob/master/{source_file})")
print("")
EOF

mdbook build docs
mv docs/book _site

Expand Down

0 comments on commit 55d7a3b

Please sign in to comment.