From 2598505dfd9f0ca9e8fdbf3460e5f54306959102 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 21 Jan 2025 17:05:47 -0500 Subject: [PATCH] docs: add generated overlays readme --- _outputs.nix | 2 +- apps/README.md | 8 ++--- .../{getModuleMeta.nix => getAttrsMeta.nix} | 0 apps/gen-docs/script.sh | 9 ++--- apps/gen-docs/templates/apps.md | 2 +- apps/gen-docs/templates/configurations.md | 2 +- apps/gen-docs/templates/devShells.md | 2 +- apps/gen-docs/templates/homeManagerModules.md | 2 +- apps/gen-docs/templates/modules.md | 2 +- apps/gen-docs/templates/overlays.md | 11 ++++++ configurations/README.md | 2 +- devShells/README.md | 2 +- homeManagerModules/README.md | 2 +- inputs/default.nix | 1 + lib/default.nix | 2 +- modules/README.md | 2 +- overlays/README.md | 11 ++++++ overlays/default.nix | 34 ++++++++++++++++--- 18 files changed, 73 insertions(+), 23 deletions(-) rename apps/gen-docs/{getModuleMeta.nix => getAttrsMeta.nix} (100%) create mode 100644 apps/gen-docs/templates/overlays.md create mode 100644 overlays/README.md diff --git a/_outputs.nix b/_outputs.nix index 17953176..d251fafd 100644 --- a/_outputs.nix +++ b/_outputs.nix @@ -129,7 +129,7 @@ nixosModules = import ./modules {inherit self;}; - overlays = import ./overlays self; + overlays = import ./overlays {inherit self;}; apps = perSystem (pkgs: diff --git a/apps/README.md b/apps/README.md index a716e2ef..00529790 100644 --- a/apps/README.md +++ b/apps/README.md @@ -1,4 +1,4 @@ -# apps +# Apps This directory contains every derivations for apps exposed by this flake. @@ -6,6 +6,6 @@ This directory contains every derivations for apps exposed by this flake. | Name | Description | | ---- | ----------- | -| `app-extract-subs` | Extract all `srt` subtitle files from a `mkv` video with the appropriate name. | -| `app-gen-docs` | Generates the READMEs in this repository from nix attributes. | -| `app-update-sources` | Updates all derivation sources in this repository and generates a commit message for the changes made. | +| `extract-subs` | Extract all `srt` subtitle files from a `mkv` video with the appropriate name. | +| `gen-docs` | Generates the READMEs in this repository from nix attributes. | +| `update-sources` | Updates all derivation sources in this repository and generates a commit message for the changes made. | diff --git a/apps/gen-docs/getModuleMeta.nix b/apps/gen-docs/getAttrsMeta.nix similarity index 100% rename from apps/gen-docs/getModuleMeta.nix rename to apps/gen-docs/getAttrsMeta.nix diff --git a/apps/gen-docs/script.sh b/apps/gen-docs/script.sh index 22f2c229..3b5c363a 100755 --- a/apps/gen-docs/script.sh +++ b/apps/gen-docs/script.sh @@ -9,13 +9,13 @@ substitute() { ) -t markdown --template "$FLAKE/apps/gen-docs/templates/$2.md" -o "$FLAKE/$2/README.md" } -substituteModule() { +substituteAttrs() { echo '' | pandoc --metadata-file <( nix eval \ --impure \ --json \ --expr "\"$FLAKE\"" \ - --apply "(import \"$FLAKE/apps/gen-docs/getModuleMeta.nix\") \"$1\"" | + --apply "(import \"$FLAKE/apps/gen-docs/getAttrsMeta.nix\") \"$1\"" | jq -r ) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md" } @@ -25,5 +25,6 @@ substitute "appsPackages" "apps" "getPackageMeta" substitute "nixosConfigurations" "configurations" "getConfigMeta" substitute "devShells" "devShells" "getPackageMeta" substitute "packages" "packages" "getPackageMeta" -substituteModule "modules" -substituteModule "homeManagerModules" +substituteAttrs "modules" +substituteAttrs "homeManagerModules" +substituteAttrs "overlays" diff --git a/apps/gen-docs/templates/apps.md b/apps/gen-docs/templates/apps.md index 43e702fa..223fa55a 100644 --- a/apps/gen-docs/templates/apps.md +++ b/apps/gen-docs/templates/apps.md @@ -1,4 +1,4 @@ -# apps +# Apps This directory contains every derivations for apps exposed by this flake. diff --git a/apps/gen-docs/templates/configurations.md b/apps/gen-docs/templates/configurations.md index 0ab64ff4..6fde7f9e 100644 --- a/apps/gen-docs/templates/configurations.md +++ b/apps/gen-docs/templates/configurations.md @@ -1,4 +1,4 @@ -# nixosConfigurations +# NixosConfigurations This directory contains every device's main configuration file, their `hardware-configuration.nix` and some custom modules unique to them. diff --git a/apps/gen-docs/templates/devShells.md b/apps/gen-docs/templates/devShells.md index 0723836a..f890ad90 100644 --- a/apps/gen-docs/templates/devShells.md +++ b/apps/gen-docs/templates/devShells.md @@ -1,4 +1,4 @@ -# devShells +# DevShells This directory contains every derivations for devShells exposed by this flake. diff --git a/apps/gen-docs/templates/homeManagerModules.md b/apps/gen-docs/templates/homeManagerModules.md index 35b85652..3f743315 100644 --- a/apps/gen-docs/templates/homeManagerModules.md +++ b/apps/gen-docs/templates/homeManagerModules.md @@ -1,4 +1,4 @@ -# homeManagerModules +# HomeManagerModules This directory contains every home-manager modules exposed by this flake. diff --git a/apps/gen-docs/templates/modules.md b/apps/gen-docs/templates/modules.md index 235ee077..c35da37c 100644 --- a/apps/gen-docs/templates/modules.md +++ b/apps/gen-docs/templates/modules.md @@ -1,4 +1,4 @@ -# nixosModules +# NixosModules This directory contains every modules for NixOS exposed by this flake. diff --git a/apps/gen-docs/templates/overlays.md b/apps/gen-docs/templates/overlays.md new file mode 100644 index 00000000..90c1583f --- /dev/null +++ b/apps/gen-docs/templates/overlays.md @@ -0,0 +1,11 @@ +# Overlays + +This directory contains every overlay exposed by this flake. + +## List of my overlays found in `self.overlays` + +| Name | Description | +| ---- | ----------- | +$for(attrs/pairs)$ +| `$it.key$` | $it.value.desc/nowrap$ | +$endfor$ diff --git a/configurations/README.md b/configurations/README.md index b49fde29..24d4b2b3 100644 --- a/configurations/README.md +++ b/configurations/README.md @@ -1,4 +1,4 @@ -# nixosConfigurations +# NixosConfigurations This directory contains every device's main configuration file, their `hardware-configuration.nix` and some custom modules unique to them. diff --git a/devShells/README.md b/devShells/README.md index 9f6be8f6..59ce05cb 100644 --- a/devShells/README.md +++ b/devShells/README.md @@ -1,4 +1,4 @@ -# devShells +# DevShells This directory contains every derivations for devShells exposed by this flake. diff --git a/homeManagerModules/README.md b/homeManagerModules/README.md index bc6276f6..cb66c7f0 100644 --- a/homeManagerModules/README.md +++ b/homeManagerModules/README.md @@ -1,4 +1,4 @@ -# homeManagerModules +# HomeManagerModules This directory contains every home-manager modules exposed by this flake. diff --git a/inputs/default.nix b/inputs/default.nix index d75ad3be..22dff08c 100644 --- a/inputs/default.nix +++ b/inputs/default.nix @@ -1,3 +1,4 @@ +# TODO: add README let inherit (import ./lib.nix) mkDep mkInput mkHyprDep mkSrc; inherit (builtins) listToAttrs map removeAttrs; diff --git a/lib/default.nix b/lib/default.nix index 3c0bd0b2..7d4e94e0 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,4 @@ -# TODO: add README and document lib +# TODO: add README and document functions { perSystem, inputs, diff --git a/modules/README.md b/modules/README.md index 3b7288b3..0642cd58 100644 --- a/modules/README.md +++ b/modules/README.md @@ -1,4 +1,4 @@ -# nixosModules +# NixosModules This directory contains every modules for NixOS exposed by this flake. diff --git a/overlays/README.md b/overlays/README.md new file mode 100644 index 00000000..e0906472 --- /dev/null +++ b/overlays/README.md @@ -0,0 +1,11 @@ +# Overlays + +This directory contains every overlay exposed by this flake. + +## List of my overlays found in `self.overlays` + +| Name | Description | +| ---- | ----------- | +| `misc-fixes` | Fixes build failures, missing meta attributes, evaluation failures, etc. of the current `nixpkgs` revision of this flake. | +| `nix-version` | Overrides the nix package for everything so I don't need multiple versions. | +| `xdg-desktop-portal-kde` | Fixes this issue: https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/issues/15 | diff --git a/overlays/default.nix b/overlays/default.nix index 4213c8c7..058e5328 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,5 +1,31 @@ -self: { - misc-fixes = import ./misc-fixes; - nix-version = import ./nix-version self; - xdg-desktop-portal-kde = import ./xdg-desktop-portal-kde; +{ + self ? {}, + description ? false, +}: let + overlay = mod: desc: + if description + then desc + else mod; +in { + misc-fixes = + overlay + (import ./misc-fixes) + '' + Fixes build failures, missing meta attributes, evaluation failures, etc. + of the current `nixpkgs` revision of this flake. + ''; + + nix-version = + overlay + (import ./nix-version self) + '' + Overrides the nix package for everything so I don't need multiple versions. + ''; + + xdg-desktop-portal-kde = + overlay + (import ./xdg-desktop-portal-kde) + '' + Fixes this issue: https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/issues/15 + ''; }