Compare commits
1 commit
main
...
syntax-hig
Author | SHA1 | Date | |
---|---|---|---|
|
6fa808d461 |
6 changed files with 707 additions and 528 deletions
|
@ -1,58 +1,55 @@
|
||||||
import { defineConfig } from "vitepress";
|
import { defineConfig } from 'vitepress'
|
||||||
|
|
||||||
// https://vitepress.dev/reference/site-config
|
// https://vitepress.dev/reference/site-config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
title: "NixiN",
|
title: "NixiN",
|
||||||
description: "A webUI to configure NixOS machines",
|
description: "A webUI to configure NixOS machines",
|
||||||
base: "/",
|
base: '/',
|
||||||
head: [
|
head: [
|
||||||
[
|
['link', { rel: 'shortcut icon', href: 'logo-nixin.svg', type: 'image/svg' }]
|
||||||
"link",
|
|
||||||
{ rel: "shortcut icon", href: "logo-nixin.svg", type: "image/svg" },
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
lastUpdated: true,
|
lastUpdated: true,
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
// https://vitepress.dev/reference/default-theme-config
|
// https://vitepress.dev/reference/default-theme-config
|
||||||
footer: {
|
footer: {
|
||||||
message: "Handcrafted with ❤️ by the DistriLab",
|
message: 'Handcrafted with ❤️ by the DistriLab',
|
||||||
copyright: "Copyleft © 2024-present the DistriLab - AGPL3 licence",
|
copyright: 'Copyleft © 2024-present the DistriLab - AGPL3 licence'
|
||||||
},
|
},
|
||||||
logo: "/logo-nixin.svg",
|
logo: '/logo-nixin.svg',
|
||||||
nav: [
|
nav: [
|
||||||
{ text: "Home", link: "/" },
|
{ text: 'Home', link: '/' },
|
||||||
{ text: "Documentation", link: "/about" },
|
{ text: 'Documentation', link: '/about' },
|
||||||
{ text: "Generate my configuration", link: "configure" },
|
{ text: 'Generate my configuration', link: 'configure' },
|
||||||
],
|
],
|
||||||
search: {
|
search: {
|
||||||
provider: "local",
|
provider: 'local'
|
||||||
},
|
},
|
||||||
sidebar: [
|
sidebar: [
|
||||||
{
|
{
|
||||||
text: "The NixiN Project",
|
text: 'The NixiN Project',
|
||||||
items: [
|
items: [
|
||||||
{ text: "About", link: "/about" },
|
{ text: 'About', link: '/about' },
|
||||||
{ text: "Technical principles", link: "/technical-principles" },
|
{ text: 'Technical principles', link: '/technical-principles' },
|
||||||
{ text: "Roadmap", link: "/roadmap" },
|
{ text: 'Roadmap', link: '/roadmap' },
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "Getting started",
|
text: 'Getting started',
|
||||||
items: [
|
items: [
|
||||||
{ text: "Local installation", link: "/installation" },
|
{ text: 'Local installation', link: '/installation' },
|
||||||
{ text: "Build virtual machine", link: "/build-virtual-machine" },
|
{ text: 'Build virtual machine', link: '/build-virtual-machine' },
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
socialLinks: [
|
socialLinks: [
|
||||||
{ icon: "github", link: "https://git.distrilab.fr/NixiN" },
|
{ icon: 'github', link: 'https://git.distrilab.fr/NixiN' }
|
||||||
//{ icon: 'mastodon', link: 'https://mastodon.cc/@mrflos' }
|
//{ icon: 'mastodon', link: 'https://mastodon.cc/@mrflos' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
ignoreDeadLinks: [
|
ignoreDeadLinks:[
|
||||||
// ignore all localhost links
|
// ignore all localhost links
|
||||||
/^https?:\/\/localhost/,
|
/^https?:\/\/localhost/,
|
||||||
],
|
]
|
||||||
});
|
})
|
||||||
|
|
|
@ -57,3 +57,7 @@
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nix-preview .shiki {
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import NixCode from "./NixCode.vue"
|
import NixCode from "./NixCode.vue"
|
||||||
import NixForm from "./NixForm.vue"
|
import NixForm from "./NixForm.vue"
|
||||||
|
import NixPreview from "./NixPreview.vue"
|
||||||
import { provide, ref } from 'vue'
|
import { provide, ref } from 'vue'
|
||||||
|
import { listTz, clientTz } from 'timezone-select-js';
|
||||||
|
|
||||||
const availableLanguages = {
|
const availableLanguages = {
|
||||||
'en_US.UTF-8': 'English',
|
'en_US.UTF-8': 'English',
|
||||||
'fr_FR.UTF-8': 'Francais'
|
'fr_FR.UTF-8': 'Francais'
|
||||||
}
|
}
|
||||||
const availableTimezones = Intl.supportedValuesOf('timeZone')
|
const availableTimezones = listTz()
|
||||||
let nixin = {
|
let nixin = {
|
||||||
netconf: 'autoconfig',
|
netconf: 'autoconfig',
|
||||||
networkingHostname: '',
|
networkingHostname: '',
|
||||||
|
@ -71,7 +73,7 @@ let nixin = {
|
||||||
}],
|
}],
|
||||||
bundles: [],
|
bundles: [],
|
||||||
services: [],
|
services: [],
|
||||||
timezone: 'UTC',
|
timezone: 'Europe/Belfast', // default to UTC but could be found with clientTz(),
|
||||||
locale: 'en_US.UTF-8',
|
locale: 'en_US.UTF-8',
|
||||||
operatingUser: 'operator',
|
operatingUser: 'operator',
|
||||||
operatingUserPassword: 'CHANGE ME !!!',
|
operatingUserPassword: 'CHANGE ME !!!',
|
||||||
|
@ -195,7 +197,7 @@ function selectServices(bundleId, services) {
|
||||||
<div class="form-cell">
|
<div class="form-cell">
|
||||||
<label>Timezone</label>
|
<label>Timezone</label>
|
||||||
<select v-model="nixin.timezone">
|
<select v-model="nixin.timezone">
|
||||||
<option v-for="tz in availableTimezones" :selected="nixin.timezone === tz" v-bind:value="tz">{{ tz }}</option>
|
<option v-for="tz in availableTimezones" :selected="nixin.timezone === tz.value" v-bind:value="tz.value">{{ tz.label }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -209,6 +211,7 @@ function selectServices(bundleId, services) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Auto-generated configuration.nix file</h2>
|
<h2>Auto-generated configuration.nix file</h2>
|
||||||
|
<NixPreview />
|
||||||
<pre class="nix-code">
|
<pre class="nix-code">
|
||||||
<code>
|
<code>
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
@ -245,7 +248,7 @@ function selectServices(bundleId, services) {
|
||||||
commands = [
|
commands = [
|
||||||
{
|
{
|
||||||
command = "ALL" ;
|
command = "ALL" ;
|
||||||
options= [ "NOPASSWD" ]; # "SETENV" # Adding the following could be a good idea
|
options= [ "NOPASSWD" ];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
88
components/NixPreview.vue
Normal file
88
components/NixPreview.vue
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
<script setup>
|
||||||
|
import { createHighlighterCoreSync } from 'shiki/core'
|
||||||
|
import { createJavaScriptRegexEngine } from 'shiki/engine/javascript'
|
||||||
|
import nix from 'shiki/langs/nix.mjs'
|
||||||
|
import nord from 'shiki/themes/nord.mjs'
|
||||||
|
import { inject, toRaw } from 'vue'
|
||||||
|
|
||||||
|
let nixin = inject('nixin')
|
||||||
|
let n = toRaw(nixin)._rawValue
|
||||||
|
const shiki = createHighlighterCoreSync({
|
||||||
|
themes: [nord],
|
||||||
|
langs: [nix],
|
||||||
|
engine: createJavaScriptRegexEngine()
|
||||||
|
})
|
||||||
|
let html = shiki.codeToHtml(`{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
networking.hosts = {
|
||||||
|
"127.0.0.1" = [ "${ n.networkingHostname }.${ n.networkingDomain}" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.hostName = "${ n.networkingHostname }";
|
||||||
|
networking.domain = "${ n.networkingDomain }";
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [
|
||||||
|
80
|
||||||
|
443
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
time.timeZone = "${ n.timezone }";
|
||||||
|
i18n.defaultLocale = "${ n.locale }";
|
||||||
|
<div v-for="(service) in nixin.services" :key="service">
|
||||||
|
<NixCode :service="service"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
users.users.${ n.operatingUser } = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
initialPassword = "${ n.operatingUserPassword }";
|
||||||
|
};
|
||||||
|
|
||||||
|
security.sudo.extraRules= [
|
||||||
|
{
|
||||||
|
users = [ "${ n.operatingUser }" ];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "ALL" ;
|
||||||
|
options= [ "NOPASSWD" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
security.acme.defaults.email = "contact@nixin.local";
|
||||||
|
security.acme.acceptTerms = true;
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Use recommended settings
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
|
||||||
|
# Only allow PFS-enabled ciphers with AES256
|
||||||
|
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
git
|
||||||
|
wget
|
||||||
|
tmux
|
||||||
|
mosh
|
||||||
|
htop
|
||||||
|
];
|
||||||
|
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
}
|
||||||
|
`, { lang: 'nix', theme: 'nord' })
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="nix-preview" v-html="html" />
|
||||||
|
</template>
|
||||||
|
|
1076
package-lock.json
generated
1076
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -13,5 +13,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitepress": "^1.3.3"
|
"vitepress": "^1.3.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"timezone-select-js": "^2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue