added stuff

This commit is contained in:
vali 2024-04-09 23:11:33 +02:00
commit 236b8c2a6b
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,449 @@
// Define variables for commonly used colors and font sizes
$primary-color: #8dc8f4;
$secondary-color: #7fb3dc;
$link-hover-color: #6ac7da;
$link-active-color: #6ac7da;
$text-color: #afbded;
$background-color: #1e1e2e;
$heading-color: #8cc6f2;
$blockquote-color: #afbded;
$table-header-bg: #afbded;
$table-border-color: #2e2e46;
$font-family: Roboto, Georgia, Palatino, Times, "Times New Roman", Lexend, serif;
$monospace-font: monospace;
$base-font-size: 14px;
// Define mixins for commonly used styles
@mixin heading-styles {
color: $heading-color;
line-height: 125%;
margin-top: 2em;
font-weight: normal;
}
@mixin media-query($breakpoint) {
@media only screen and (min-width: $breakpoint) {
@content;
}
}
@keyframes bounce {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-5px);
}
}
// Begin SCSS stylesheet
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body {
color: $text-color;
font-family: $font-family;
font-size: $base-font-size;
line-height: 1.7;
padding: 1em;
margin: auto;
max-width: 42em;
background: $background-color;
@include media-query(480px) {
font-size: 14px;
}
@include media-query(768px) {
font-size: 16px;
}
}
a {
color: $primary-color;
text-decoration: none;
&:visited {
color: $secondary-color;
}
&:hover {
color: $link-hover-color;
}
&:active {
color: $link-active-color;
}
&:focus {
outline: thin dotted;
}
&::-moz-selection {
background: rgba($primary-color, 0.3);
color: $text-color;
}
&::selection {
background: rgba($primary-color, 0.3);
color: $text-color;
}
&::-moz-selection {
background: rgba($primary-color, 0.3);
color: $primary-color;
}
&::selection {
background: rgba($primary-color, 0.3);
color: $primary-color;
}
}
p {
margin: 1em 0;
}
img {
max-width: 100%;
}
h1,
h2,
h3,
h4,
h5,
h6 {
@include heading-styles;
h4,
h5,
h6 {
font-weight: bold;
}
h1 {
font-size: 2.5em;
}
h2 {
font-size: 2em;
}
h3 {
font-size: 1.5em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1em;
}
h6 {
font-size: 0.9em;
}
}
blockquote {
color: $blockquote-color;
margin: 0;
padding-left: 3em;
border-left: 0.5em $background-color solid;
}
hr {
display: block;
height: 2px;
border: 0;
border-top: 1px solid $table-border-color;
border-bottom: 1px solid $background-color;
margin: 1em 0;
padding: 0;
}
pre,
code,
kbd,
samp {
color: $text-color;
font-family: $monospace-font;
_font-family: "courier new", monospace;
font-size: 0.98em;
}
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
ins {
background: $primary-color;
color: $text-color;
text-decoration: none;
}
mark {
background: $primary-color;
color: $text-color;
font-style: italic;
font-weight: bold;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
}
ul,
ol {
margin: 1em 0;
padding: 0 0 0 2em;
ul ul,
ol ol {
margin: 0.3em 0;
}
}
dl {
margin-bottom: 1em;
}
dt {
font-weight: bold;
margin-bottom: 0.8em;
}
dd {
margin: 0 0 0.8em 2em;
&:last-child {
margin-bottom: 0;
}
}
img {
border: 0;
-ms-interpolation-mode: bicubic;
vertical-align: middle;
}
figure {
display: block;
text-align: center;
margin: 1em 0;
img {
border: none;
margin: 0 auto;
}
figcaption {
font-size: 0.8em;
font-style: italic;
margin: 0 0 0.8em;
}
}
table {
margin-bottom: 2em;
border-bottom: 1px solid $table-border-color;
border-right: 1px solid $table-border-color;
border-spacing: 0;
border-collapse: collapse;
th {
padding: 0.2em 1em;
background-color: $table-header-bg;
border-top: 1px solid $table-border-color;
border-left: 1px solid $table-border-color;
}
td {
padding: 0.2em 1em;
border-top: 1px solid $table-border-color;
border-left: 1px solid $table-border-color;
vertical-align: top;
}
}
.author {
font-size: 1.2em;
text-align: center;
}
@media print {
* {
background: transparent !important;
color: $text-color !important;
filter: none !important;
-ms-filter: none !important;
}
body {
font-size: 12pt;
max-width: 100%;
}
a,
a:visited {
text-decoration: underline;
}
hr {
height: 1px;
border: 0;
border-bottom: 1px solid $text-color;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid $text-color;
padding-right: 1em;
page-break-inside: avoid;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page :left {
margin: 15mm 20mm 15mm 10mm;
}
@page :right {
margin: 15mm 10mm 15mm 20mm;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
// Sidebar style, contains the ToC with clickable links
.sidebar {
position: fixed;
top: 0;
left: -1000px; // Initially hidden by being yoten offscreen
height: 100%;
width: 490px; // Static content width. FIXME: ugh
background-color: darken($background-color, 2%);
overflow-x: hidden; // Horizontal scrollbar
overflow-y: auto; // Vertical scrollbar if needed
transition: left 0.3s; // "Smooth" slide animation
padding: 10px;
z-index: 1000; // Ensure sidebar is above content
}
.sidebar.show {
left: 0; // Show sidebar when toggled
border: 1px solid darken($background-color, 5%);
}
// Togglee sidebar
.toggle-btn {
position: fixed;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
color: lighten($text-color, 2%);
font-size: 16px;
transition: left 0.3s;
&:hover {
color: lighten($text-color, 4%);
}
}
.toggle-btn.left {
left: 20px;
}
.toggle-btn.right {
left: 520px;
}
// Go back button
.go-back-btn {
position: fixed;
bottom: 20px;
right: 20px;
width: 50px;
height: 50px;
background-color: lighten($background-color, 4%);
color: $text-color;
border-radius: 10px;
cursor: pointer;
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.3s ease;
&:hover {
color: lighten($background-color, 4%);
background-color: lighten($background-color, 8%);
}
i {
font-size: 20px;
}
}

View file

@ -0,0 +1,117 @@
<!doctype html>
<html
xmlns="http://www.w3.org/1999/xhtml"
lang="$lang$"
xml:lang="$lang$"
$if(dir)$
dir="$dir$"
$endif$
>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes"
/>
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$ $if(date-meta)$
<meta name="dcterms.date" content="$date-meta$" />
$endif$ $if(keywords)$
<meta
name="keywords"
content="$for(keywords)$$keywords$$sep$, $endfor$"
/>
$endif$ $if(description-meta)$
<meta name="description" content="$description-meta$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ $endif$$pagetitle$</title>
<style>
$styles.html()$
</style>
$for(css)$
<link rel="stylesheet" href="$css$" />
$endfor$ $for(header-includes)$ $header-includes$ $endfor$ $if(math)$
$if(mathjax)$
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
$endif$ $math$ $endif$
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
<!-- Font Awesome -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
/>
</head>
<body>
$for(include-before)$ $include-before$ $endfor$ $if(title)$
<header id="title-block-header">
<h1 class="title">$title$</h1>
$if(subtitle)$
<p class="subtitle">$subtitle$</p>
$endif$ $for(author)$
<p class="author">$author$</p>
$endfor$ $if(date)$
<p class="date">$date$</p>
$endif$ $if(abstract)$
<div class="abstract">
<div class="abstract-title">$abstract-title$</div>
$abstract$
</div>
$endif$
</header>
$endif$
<!-- Toggle button -->
<div class="toggle-btn left" onclick="toggleSidebar()">
<i class="fa-solid fa-chevron-right" id="toggle-icon"></i>
</div>
<!-- Sidebar -->
<div class="sidebar" id="sidebar">
<div class="sidebar-content">
<nav id="$idprefix$TOC" role="doc-toc">
$if(toc-title)$
<h2 id="$idprefix$toc-title">$toc-title$</h2>
$endif$ $table-of-contents$
</nav>
</div>
</div>
<!-- Main Body -->
<div class="content" id="content">$body$</div>
<!-- "Go back" button -->
<div class="go-back-btn" onclick="goToTop()">
<i class="fas fa-arrow-up"></i>
</div>
<!-- JS for toggle button -->
<script>
function toggleSidebar() {
var sidebar = document.getElementById("sidebar");
var toggleBtn = document.querySelector(".toggle-btn");
var toggleIcon = document.getElementById("toggle-icon");
sidebar.classList.toggle("show");
if (sidebar.classList.contains("show")) {
toggleBtn.classList.remove("left");
toggleBtn.classList.add("right");
toggleIcon.classList.remove("fa-chevron-right");
toggleIcon.classList.add("fa-chevron-left");
} else {
toggleBtn.classList.remove("right");
toggleBtn.classList.add("left");
toggleIcon.classList.remove("fa-chevron-left");
toggleIcon.classList.add("fa-chevron-right");
}
}
function goToTop() {
window.scrollTo({ top: 0, behavior: "smooth" });
}
</script>
$for(include-after)$ $include-after$ $endfor$
</body>
</html>

View file

@ -0,0 +1,211 @@
{
"text-color": null,
"background-color": null,
"line-number-color": "#aaaaaa",
"line-number-background-color": null,
"text-styles": {
"Alert": {
"text-color": "#ff0000",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"Annotation": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
},
"Attribute": {
"text-color": "#7d9029",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"BaseN": {
"text-color": "#40a070",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"BuiltIn": {
"text-color": "#008000",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Char": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Comment": {
"text-color": "#60a0b0",
"background-color": null,
"bold": false,
"italic": true,
"underline": false
},
"CommentVar": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
},
"Constant": {
"text-color": "#880000",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"ControlFlow": {
"text-color": "#007020",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"DataType": {
"text-color": "#902000",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"DecVal": {
"text-color": "#40a070",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Documentation": {
"text-color": "#ba2121",
"background-color": null,
"bold": false,
"italic": true,
"underline": false
},
"Error": {
"text-color": "#ff0000",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"Extension": {
"text-color": null,
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Float": {
"text-color": "#40a070",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Function": {
"text-color": "#06287e",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Import": {
"text-color": "#008000",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"Information": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
},
"Keyword": {
"text-color": "#007020",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"Operator": {
"text-color": "#666666",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Other": {
"text-color": "#007020",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Preprocessor": {
"text-color": "#bc7a00",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"SpecialChar": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"SpecialString": {
"text-color": "#bb6688",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"String": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Variable": {
"text-color": "#19177c",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"VerbatimString": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Warning": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
}
}
}

View file

@ -0,0 +1,101 @@
{
options,
config,
pkgs,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.types) nullOr path str package;
inherit (lib.strings) optionalString;
cfg = config.modules.documentation;
configMD =
(pkgs.nixosOptionsDoc {
options = options.modules;
documentType = "appendix";
inherit (cfg) warningsAreErrors;
})
.optionsCommonMark;
compileCss = pkgs.runCommandLocal "compile-css" {} ''
mkdir -p $out
${cfg.scssExecutable} -t expanded ${cfg.scss} > $out/sys-docs-style.css
'';
docs-html = pkgs.runCommand "nyxos-docs" {nativeBuildInputs = [pkgs.pandoc];} (
''
# convert to pandoc markdown instead of using commonmark directly,
# as the former automatically generates heading ids and TOC links.
pandoc \
--from commonmark \
--to markdown \
${configMD} |
# convert pandoc markdown to html using our own template and css files
# where available. --sandbox is passed for extra security.
pandoc \
--sandbox \
--from markdown \
--to html \
--metadata title="NyxOS Docs" \
--toc \
--standalone \
''
+ optionalString (cfg.templatePath != null) ''--template ${cfg.templatePath} \''
+ optionalString (cfg.scss != null) ''--css=${compileCss.outPath}/sys-docs-style.css \''
+ "-o $out"
);
in {
options.modules.documentation = {
enable = mkEnableOption ''
generation of internal module documentation for my system configuration. If enabled
the module options will be rendered with pandoc and linked to `/etc/nyxos`
'';
warningsAreErrors = mkEnableOption ''
enforcing build failure on missing option descriptions. While disabled, warnings will be
displayed, but will not cause the build to fail.
'';
scss = mkOption {
default = ./assets/default-style.scss;
type = nullOr path;
description = "CSS to apply to the docs";
};
scssExecutable = mkOption {
default = lib.getExe' pkgs.sass "scss";
example = literalExpression "${pkgs.dart-sass}/bin/sass";
type = nullOr str;
description = "Path to the sass executable";
};
templatePath = mkOption {
default = ./assets/default-template.html;
type = nullOr path;
description = "The template to use for the docs";
};
# the following are exposed as module options for us to be able to build them in isolation
# i.e. without building the rest of the system
markdownPackage = mkOption {
default = configMD;
type = nullOr package;
readOnly = true;
description = "The package containing generated markdown";
};
htmlPackage = mkOption {
default = docs-html;
type = nullOr package;
readOnly = true;
description = "The package containing generated HTML";
};
# TODO: custom syntax highlighting via syntax.json path OR attrset to json
# we love json. yaml is json. we should use yaml. yes.
};
}