feat: refactor to add apps README
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
2cab8107ba
commit
546eda3ee2
12 changed files with 81 additions and 52 deletions
|
@ -133,11 +133,11 @@
|
|||
|
||||
apps =
|
||||
perSystem (pkgs:
|
||||
import ./apps {inherit inputs pkgs;});
|
||||
import ./apps {inherit pkgs self;});
|
||||
|
||||
appsPackages =
|
||||
perSystem (pkgs:
|
||||
import ./apps/packages.nix {inherit pkgs self;});
|
||||
import ./apps/packages.nix {inherit inputs pkgs;});
|
||||
|
||||
devShells =
|
||||
perSystem (pkgs:
|
||||
|
|
11
apps/README.md
Normal file
11
apps/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# apps
|
||||
|
||||
This directory contains every derivations for apps exposed by this flake.
|
||||
|
||||
## List of my apps found in `self.apps`
|
||||
|
||||
| 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. |
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
runtimeInputs,
|
||||
npmDepsHash,
|
||||
src,
|
||||
lib,
|
||||
src,
|
||||
npmDepsHash,
|
||||
runtimeInputs,
|
||||
buildNpmPackage,
|
||||
meta,
|
||||
makeWrapper,
|
||||
nodejs_latest,
|
||||
jq,
|
||||
|
@ -13,12 +14,11 @@
|
|||
inherit (builtins) fromJSON readFile;
|
||||
|
||||
packageJSON = fromJSON (readFile "${src}/package.json");
|
||||
pname = packageJSON.name;
|
||||
inherit (packageJSON) version;
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
pname = packageJSON.name;
|
||||
inherit (packageJSON) version;
|
||||
|
||||
inherit src runtimeInputs npmDepsHash;
|
||||
buildNpmPackage {
|
||||
inherit pname version src runtimeInputs npmDepsHash;
|
||||
|
||||
prePatch = ''
|
||||
mv ./tsconfig.json ./project.json
|
||||
|
@ -35,5 +35,6 @@ in
|
|||
'';
|
||||
|
||||
nodejs = nodejs_latest;
|
||||
meta.mainProgram = pname;
|
||||
|
||||
meta = {mainProgram = pname;} // meta;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,17 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.lib) getExe listToAttrs nameValuePair;
|
||||
inherit (pkgs.lib) getExe mapAttrs' nameValuePair removePrefix;
|
||||
|
||||
buildApp = attrs: (pkgs.callPackage ./buildApp.nix ({} // inputs // attrs));
|
||||
|
||||
mkNodeApp = file: {
|
||||
program = getExe (pkgs.callPackage file ({inherit buildApp;} // inputs));
|
||||
mkApp = pkg: {
|
||||
program = getExe pkg;
|
||||
type = "app";
|
||||
};
|
||||
|
||||
mkNodeApps = apps: listToAttrs (map (x: nameValuePair x (mkNodeApp ./${x})) apps);
|
||||
in
|
||||
mkNodeApps [
|
||||
"extract-subs"
|
||||
"update-sources"
|
||||
]
|
||||
// {
|
||||
gen-docs = {
|
||||
program = getExe (pkgs.callPackage ./gen-docs {});
|
||||
type = "app";
|
||||
};
|
||||
}
|
||||
mapAttrs' (
|
||||
n: v:
|
||||
nameValuePair (removePrefix "app-" n) (mkApp v)
|
||||
)
|
||||
self.appsPackages.${pkgs.system}
|
||||
|
|
|
@ -10,4 +10,8 @@ buildApp {
|
|||
runtimeInputs = [
|
||||
ffmpeg-full
|
||||
];
|
||||
|
||||
meta.description = ''
|
||||
Extract all `srt` subtitle files from a `mkv` video with the appropriate name.
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -8,4 +8,8 @@ writeShellApplication {
|
|||
name = "gen-docs";
|
||||
runtimeInputs = [jq pandoc];
|
||||
text = builtins.readFile ./script.sh;
|
||||
|
||||
meta.description = ''
|
||||
Generates the READMEs in this repository from nix attributes.
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
packageMetaFunc=$(cat << EOF
|
||||
(x: {
|
||||
attrs = builtins.mapAttrs (_: v: {
|
||||
desc = builtins.replaceStrings ["\n"] [""] (v.meta.description or "");
|
||||
desc = builtins.replaceStrings ["\n"] [" "] (v.meta.description or "");
|
||||
homepage = v.meta.homepage or "";
|
||||
}) (builtins.removeAttrs x.\${builtins.currentSystem} ["default"]);
|
||||
})
|
||||
|
@ -14,10 +14,11 @@ substitute() {
|
|||
nix eval \
|
||||
--impure \
|
||||
--json \
|
||||
.#"$1" \
|
||||
"$FLAKE"#"$1" \
|
||||
--apply "$packageMetaFunc" |
|
||||
jq -r
|
||||
) -t markdown --template "$2" -o "$3"
|
||||
}
|
||||
|
||||
substitute "devShells" "$FLAKE/apps/gen-docs/templates/devShells.md" "$FLAKE/devShells/README.md"
|
||||
substitute "appsPackages" "$FLAKE/apps/gen-docs/templates/apps.md" "$FLAKE/apps/README.md"
|
||||
|
|
11
apps/gen-docs/templates/apps.md
Normal file
11
apps/gen-docs/templates/apps.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# apps
|
||||
|
||||
This directory contains every derivations for apps exposed by this flake.
|
||||
|
||||
## List of my apps found in `self.apps`
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
$for(attrs/pairs)$
|
||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
||||
$endfor$
|
|
@ -7,5 +7,5 @@ This directory contains every derivations for devShells exposed by this flake.
|
|||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
$for(attrs/pairs)$
|
||||
| $it.key$ | $it.value.desc/nowrap$ |
|
||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
||||
$endfor$
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.lib) mapAttrs removeSuffix;
|
||||
inherit (pkgs.lib) listToAttrs nameValuePair;
|
||||
|
||||
buildApp = attrs: (pkgs.callPackage ./buildApp.nix ({} // inputs // attrs));
|
||||
callPackage = file: pkgs.callPackage file ({inherit buildApp;} // inputs);
|
||||
in
|
||||
mapAttrs (
|
||||
name: app: (pkgs.symlinkJoin {
|
||||
name = "app-${name}";
|
||||
paths = [(removeSuffix "/bin/${name}" (toString app.program))];
|
||||
})
|
||||
)
|
||||
(removeAttrs self.apps.${pkgs.system} ["genflake"])
|
||||
listToAttrs (map (x: nameValuePair "app-${x}" (callPackage ./${x})) [
|
||||
"extract-subs"
|
||||
"gen-docs"
|
||||
"update-sources"
|
||||
])
|
||||
|
|
|
@ -18,4 +18,9 @@ buildApp {
|
|||
prefetch-npm-deps
|
||||
(callPackage ../../modules/docker/updateImage.nix {})
|
||||
];
|
||||
|
||||
meta.description = ''
|
||||
Updates all derivation sources in this repository and
|
||||
generates a commit message for the changes made.
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -6,14 +6,14 @@ This directory contains every derivations for devShells exposed by this flake.
|
|||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| c-lang | c-lang shell to be loaded by my Neovim config dynamically. |
|
||||
| csharp | csharp shell to be loaded by my Neovim config dynamically. |
|
||||
| flake | Shell providing some utility scripts concerning the main flake. |
|
||||
| json | json shell to be loaded by my Neovim config dynamically. |
|
||||
| lua | lua shell to be loaded by my Neovim config dynamically. |
|
||||
| markdown | markdown shell to be loaded by my Neovim config dynamically. |
|
||||
| netdaemon | Shell that makes sure we have the right dotnet-sdk version for NetDaemon development. |
|
||||
| node | Shell that provides `bumpNpmDeps`, node and typescript. |
|
||||
| rust | rust shell to be loaded by my Neovim config dynamically. |
|
||||
| subtitles-dev | Shell that provides the dependencies for my subtitle management scripts. |
|
||||
| web | web shell to be loaded by my Neovim config dynamically. |
|
||||
| `c-lang` | c-lang shell to be loaded by my Neovim config dynamically. |
|
||||
| `csharp` | csharp shell to be loaded by my Neovim config dynamically. |
|
||||
| `flake` | Shell providing some utility scripts concerning the main flake. |
|
||||
| `json` | json shell to be loaded by my Neovim config dynamically. |
|
||||
| `lua` | lua shell to be loaded by my Neovim config dynamically. |
|
||||
| `markdown` | markdown shell to be loaded by my Neovim config dynamically. |
|
||||
| `netdaemon` | Shell that makes sure we have the right dotnet-sdk version for NetDaemon development. |
|
||||
| `node` | Shell that provides `bumpNpmDeps`, node and typescript. |
|
||||
| `rust` | rust shell to be loaded by my Neovim config dynamically. |
|
||||
| `subtitles-dev` | Shell that provides the dependencies for my subtitle management scripts. |
|
||||
| `web` | web shell to be loaded by my Neovim config dynamically. |
|
||||
|
|
Loading…
Reference in a new issue