From fdbd5cb2dfb951d29d19a7901f995171cc45b040 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 21 Jan 2025 20:45:05 -0500 Subject: [PATCH] docs: add generated scopedPackages readme --- apps/gen-docs/script.sh | 4 ++- apps/gen-docs/templates/scopedPackages.md | 11 ++++++ scopedPackages/README.md | 16 +++++---- scopedPackages/default.nix | 43 ++++++++++++++++------- 4 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 apps/gen-docs/templates/scopedPackages.md diff --git a/apps/gen-docs/script.sh b/apps/gen-docs/script.sh index 3b5c363a..e169df82 100755 --- a/apps/gen-docs/script.sh +++ b/apps/gen-docs/script.sh @@ -20,7 +20,6 @@ substituteAttrs() { ) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md" } -# TODO: add overlays, scopedPackages substitute "appsPackages" "apps" "getPackageMeta" substitute "nixosConfigurations" "configurations" "getConfigMeta" substitute "devShells" "devShells" "getPackageMeta" @@ -28,3 +27,6 @@ substitute "packages" "packages" "getPackageMeta" substituteAttrs "modules" substituteAttrs "homeManagerModules" substituteAttrs "overlays" + +# TODO: add metadata of all packages +substituteAttrs "scopedPackages" diff --git a/apps/gen-docs/templates/scopedPackages.md b/apps/gen-docs/templates/scopedPackages.md new file mode 100644 index 00000000..7adf0319 --- /dev/null +++ b/apps/gen-docs/templates/scopedPackages.md @@ -0,0 +1,11 @@ +# ScopedPackages + +This directory contains every package scopes exposed by this flake. + +## List of my package scopes found in `self.scopedPackages` + +| Name | Description | +| ---- | ----------- | +$for(attrs/pairs)$ +| `$it.key$` | $it.value.desc/nowrap$ | +$endfor$ diff --git a/scopedPackages/README.md b/scopedPackages/README.md index 5560b889..29b4c791 100644 --- a/scopedPackages/README.md +++ b/scopedPackages/README.md @@ -1,11 +1,13 @@ # ScopedPackages -This directory encompasses every derivation scopes for packages exposed by my flake. +This directory contains every package scopes exposed by this flake. -## List of package scopes found in `self.scopedPackages` +## List of my package scopes found in `self.scopedPackages` -| Name | Description | -| --------------- | ----------- | -| `dracula` | Themes for many apps from the [Dracula GitHub Org](https://github.com/dracula) | -| `firefoxAddons` | Firefox extensions updated with [mozilla-addons-to-nix](https://git.sr.ht/~rycee/mozilla-addons-to-nix) | -| `mpvScripts` | MPV scripts I use that are not in nixpkgs | +| Name | Description | +| ---- | ----------- | +| `dracula` | Custom derivations that each represent an app's Dracula Theme. | +| `firefoxAddons` | Every extensions I use in my firefox module. | +| `hass-components` | Components I use for Home-Assistant that aren't in nixpkgs. | +| `lovelace-components` | Lovelace components I use for Home-Assistant that aren't in nixpkgs. | +| `mpvScripts` | MPV scripts I use that aren't in nixpkgs. | diff --git a/scopedPackages/default.nix b/scopedPackages/default.nix index 4c16de72..e0047cc7 100644 --- a/scopedPackages/default.nix +++ b/scopedPackages/default.nix @@ -1,18 +1,35 @@ { - inputs, - mkVersion, - pkgs, - ... + inputs ? {}, + mkVersion ? {}, + pkgs ? {}, + description ? false, }: let - inherit (pkgs) lib; + inherit (pkgs.lib) recurseIntoAttrs; - mkScope = file: - lib.recurseIntoAttrs - (pkgs.callPackage file ({inherit mkVersion;} // inputs)); + mkScope = file: desc: + if description + then desc + else + recurseIntoAttrs + (pkgs.callPackage file ({inherit mkVersion;} // inputs)); in { - dracula = mkScope ./dracula; - firefoxAddons = mkScope ./firefox-addons; - hass-components = mkScope ./hass-components; - lovelace-components = mkScope ./lovelace-components; - mpvScripts = mkScope ./mpv-scripts; + dracula = mkScope ./dracula '' + Custom derivations that each represent an app's Dracula Theme. + ''; + + firefoxAddons = mkScope ./firefox-addons '' + Every extensions I use in my firefox module. + ''; + + hass-components = mkScope ./hass-components '' + Components I use for Home-Assistant that aren't in nixpkgs. + ''; + + lovelace-components = mkScope ./lovelace-components '' + Lovelace components I use for Home-Assistant that aren't in nixpkgs. + ''; + + mpvScripts = mkScope ./mpv-scripts '' + MPV scripts I use that aren't in nixpkgs. + ''; }