Add docsga

This commit is contained in:
DashieTM 2024-08-27 23:51:52 +02:00
parent a50f970eda
commit 2195c7a850
10 changed files with 98 additions and 17 deletions

57
.github/workflows/docs.yaml vendored Normal file
View file

@ -0,0 +1,57 @@
name: Docs
on:
push:
branches:
- main
jobs:
build:
name: Build
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: |
extra-experimental-features = nix-command flakes
- name: Set up cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build docs
run: nix -L build github:${{ github.repository }}/${{ github.sha }}#docs
- name: Prepare docs for upload
run: cp -r --dereference --no-preserve=mode,ownership result/ public/
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: public/
deploy:
name: Deploy
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy docs to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View file

@ -24,7 +24,8 @@ in
plymouth = { plymouth = {
enable = true; enable = true;
}; };
kernelPackages = config.conf.kernel; #kernelPackages = config.conf.kernel;
kernelPackages = pkgs.linuxPackages_latest;
initrd = { initrd = {
verbose = false; verbose = false;
availableKernelModules = [ availableKernelModules = [

17
docs/default.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, build_systems, ... }:
let
makeOptionsDoc = configuration: pkgs.nixosOptionsDoc { inherit (configuration) options lib; };
example = makeOptionsDoc (build_systems [ "example" ] ../example/.)."example";
in
pkgs.stdenvNoCC.mkDerivation {
name = "dashNix-book";
src = ./.;
patchPhase = ''
sed '/*Declared by:*/,/^$/d' <${example.optionsCommonMark} >> src/dashNix.md
'';
buildPhase = ''
${pkgs.mdbook}/bin/mdbook build --dest-dir $out
'';
}

0
docs/src/SUMMARY.md Normal file
View file

1
docs/src/dashNix.md Executable file
View file

@ -0,0 +1 @@
pingpang

View file

@ -66,8 +66,12 @@
}; };
}; };
in in
{ rec {
dashNixLib = import ./lib { inherit inputs pkgs; }; dashNixLib = import ./lib { inherit inputs pkgs; };
docs = import ./docs {
inherit inputs pkgs;
build_systems = dashNixLib.build_systems;
};
dashNixInputs = inputs; dashNixInputs = inputs;
stablePkgs = stable; stablePkgs = stable;
unstablePkgs = pkgs; unstablePkgs = pkgs;

View file

@ -93,14 +93,14 @@
}; };
}; };
kernel = lib.mkOption { #kernel = lib.mkOption {
default = pkgs.linuxPackages_latest; # default = pkgs.linuxPackages_latest;
example = pkgs.linuxPackages_xanmod_latest; # example = pkgs.linuxPackages_xanmod_latest;
type = with lib.types; nullOr attrs; # type = with lib.types; nullOr attrs;
description = '' # description = ''
kernel to be used # kernel to be used
''; # '';
}; #};
hostname = lib.mkOption { hostname = lib.mkOption {
default = "nixos"; default = "nixos";
@ -203,9 +203,9 @@
config = config =
{ {
conf.kernel = lib.mkIf ( # conf.kernel = lib.mkIf (
config.mods.gaming.enable && config.mods.gaming.kernel # config.mods.gaming.enable && config.mods.gaming.kernel
) pkgs.linuxPackages_xanmod_latest; # ) pkgs.linuxPackages_xanmod_latest;
} }
// (lib.optionalAttrs (options ? system.stateVersion) { // (lib.optionalAttrs (options ? system.stateVersion) {
system.stateVersion = config.conf.systemStateVersion; system.stateVersion = config.conf.systemStateVersion;

View file

@ -20,7 +20,7 @@
additional_packages = lib.mkOption { additional_packages = lib.mkOption {
default = [ ]; default = [ ];
example = [ pkgs.openssl ]; example = [ pkgs.openssl ];
type = with lib.types; listOf packages; type = with lib.types; listOf package;
description = '' description = ''
Additional packages to install. Additional packages to install.
Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install. Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install.

View file

@ -22,12 +22,12 @@
ssh_config = lib.mkOption { ssh_config = lib.mkOption {
default = '' default = ''
Host github.com Host github.com
${if (config.sops.secrets ? hub.path) then "IdentityFile ${config.sops.secrets.hub.path}" else ""} ${if (config ? sops.secrets ? hub.path) then "IdentityFile ${config.sops.secrets.hub.path}" else ""}
Host gitlab.com Host gitlab.com
${if (config.sops.secrets ? lab.path) then "IdentityFile ${config.sops.secrets.lab.path}" else ""} ${if (config ? sops.secrets ? lab.path) then "IdentityFile ${config.sops.secrets.lab.path}" else ""}
Host dashie.org Host dashie.org
${ ${
if (config.sops.secrets ? dashie.path) then if (config ? sops.secrets ? dashie.path) then
"IdentityFile ${config.sops.secrets.dashie.path}" "IdentityFile ${config.sops.secrets.dashie.path}"
else else
"" ""

1
result Symbolic link
View file

@ -0,0 +1 @@
/nix/store/hpbdpm0knf560f4igq5yc6c6nvap7s65-dashNix-book