wip on making it proper

master
Ingolf Wagner 2021-07-19 20:21:28 +02:00
parent 734df9f2b0
commit 4260f0770b
Signed by: palo
GPG Key ID: 76BF5F1928B9618B
14 changed files with 769 additions and 0 deletions

11
content/about.md Normal file
View File

@ -0,0 +1,11 @@
---
title: About me
---
# About Me
I'm a freelancing Mathematician, Full Stack Developer and DevOps.
[NixOS](https://nixos.org) is my Operation System of choice.
When I'm not doing stuff on my computer I play video games or make some photos
on my journeys. Have a look at my [travel page](http://travel.ingolf-wagner.de).

114
content/slides/terranix.html Executable file
View File

@ -0,0 +1,114 @@
---
title: terranix
date: 2019-08-23
info: An introduction on terranix for nixos users.
scheme: light
qrcode-link: qr-tech-ingolf-wag.svg
---
# What is Terraform
* A declarative configuration tool to describe state behind an API
* AWS, Azure, Hetzner, Google Cloud, Akamai, Github, Grafana, [and more](https://www.terraform.io/docs/providers/index.html)
* comes with a painful language called [HCL](https://www.terraform.io/docs/configuration/syntax.html).
---
# What is terranix?
* Tool to render nix-modules to terraform json
* Is much more pleasant and powerful than [HCL](https://www.terraform.io/docs/configuration/syntax.html)
---
# Workflow
```
config.nix → config.tf.json → terraform.state
```
```shell
terranix > config.tf.json && terraform init && terraform apply
```
---
## config.nix example (provider)
A small example to define some repositories and users in [github](https://www.terraform.io/docs/providers/github/index.html).
```nix
# Configure the GitHub Provider
provider.github = {
token = "\${var.github_token}";
organization = "nixos-community";
};
```
---
## config.nix example (code)
```nix
# Create a github repository
resource.github_repository.example = {
name = "example";
description = "My awesome codebase";
};
# Add a collaborator to a repository
resource.github_repository_collaborator.a_repo_collaborator = {
repository = config.resource.github_repository.example.name;
username = config.data.github_user.palo.username;
permission = "push";
};
# query an existing user
data.github_user.palo.username = "mrVanDalo";
```
---
# Merging configuration
* merging `resources`, `data`, `output`, ... is not possible.
* you have to create an opinionated module with proper types to get them merged.
--
```nix
# server.nix
resource.hcloud_server.example ={
name = "example";
image = "debian-9";
};
# config-testing.nix
resource.hcloud_server.example.server_type = "cx11";
# config-production.nix
resource.hcloud_server.example.server_type = "cx31";
```
---
# a basic setup
* an example setup is at [nix-shell-mix](https://github.com/mrVanDalo/nix-shell-mix/blob/master/terraform/shell.nix)
### shell.nix
```nix
pkgs.writeShellScriptBin "terraform" let
pass = id: "${pkgs.pass}/bin/pass ${id}"
in ''
export TF_VAR_github_token=`${pass github/token}`
${pkgs.terraform}/bin/terraform "$@"
'';
```
---
# Road map
* documentation generation like for `man configuration.nix` in nixos for your own modules
* resource merging solution that is easy to hack, and adept to even with a large code base.
* always be backwards compatible.
* Better documentation.

View File

@ -0,0 +1,227 @@
---
title: Why NixOS
date: 2019-04-26
scheme: light
qrcode-link: why-nixos-qrcode.svg
info: |
A Presentation about NixOS which only focuses on the positive sides of NixOS.
It should give listeners an impression on what they gain,
when using NixOS as their Operation System.
---
# Why NixOS
NixOS is not perfect (but very very good).
Let's look at the good parts.
---
# What is NixOS ?
* Operation System based on [Nix Package manager](https://nixos.org/nix/).
* builtin `provisioning` system.
* `x86_32`, `x86_64`, `ARM6`, `ARM7`, `ARM8`, `AARCH64` (and many more).
* `channels` ( stable, unstable, ... ).
* 2 stable releases per year.
---
# NixOS Features
* [idempotent](https://en.wikipedia.org/wiki/Idempotence) and more.
* rollbacks (without re-provisioning).
* powerful [package system](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/nano/default.nix)
with [modding](https://nixos.org/nixpkgs/manual/#sec-overrides)
* [overlays](https://nixos.wiki/wiki/Overlays)
* no [Dependency-Hell](https://en.wikipedia.org/wiki/Dependency_hell).
* [container-system](https://nixos.org/nixos/manual/#ch-containers) ([systemd-nspawn](https://wiki.archlinux.org/index.php/Systemd-nspawn) based).
* cross-compilation (using [binfmt](https://en.wikipedia.org/wiki/Binfmt_misc)).
---
### configuration.nix Example
```nix
{ config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
./systemd-example.nix
];
networking.hostName = "mymachine";
time.timeZone = "Europe/Berlin";
users.users.myuser = {
extraGroups = [ "wheel" "networkmanager" ];
isNormalUser = true;
};
environment.systemPackages = [ pkgs.git pkgs.vim pkgs.sl ];
serivce.avahi.enable = true;
}
```
---
### SystemD Service Example
```nix
{ config, pkgs, ... }:
let
myWebsite = pkgs.fetchgit {
src = https://github.com/mrVanDalo/landingpage.git;
rev = "f67336e0cc97c8dd118d3cafb899bce7e60280e8";
sha = "03g8b6zwrg9jyvg9iipd3dfpfimvq5qn0cxa3b24skqq3ap4wcgk";
};
in {
users.users.mypageuser.isNormalUser = false;
systemd.services.mypage = {
enable = true;
serviceConfig.User = config.users.users.mypageuser.name;
wantedBy = [ "multi-user.target" ];
script = /* sh */ ''
cd ${myWebsite}/docs
${pkgs.python}/bin/python -m SimpleHTTPServer 9000
'';
}
networking.firewall.allowedTCPPorts = [ 9000 ];
}
```
---
# Nix-Shell
* shell *(bash)* with modified run-time environment.
* software is **not** installed "system-wide"
--
`gimp` only in a shell
```
nix-shell -p gimp
```
---
## shell.nix example
```nix
{ pkgs ? import <nixpkgs> {} }:
let
buildScript = pkgs.writers.writeDashBin "build" /* sh */ ''
${pkgs.lessc}/bin/lessc \
${toString ./src/lessc/main.less} \
${toString ./assets/generated/main.css}
'';
in pkgs.mkShell {
buildInputs = [
pkgs.elmPackages.elm
pkgs.vscode
buildScript
];
shellHook = ''
HISTFILE=${toString ./.history}
'';
}
```
---
# NixOS Generators
community driven [tool](https://github.com/nix-community/nixos-generators)
to create various images.
```nix
{
services.sshd.enable = true;
users.users.root.openssh.authorizedKeys.keyFiles = ./sshKeys;
services.home-assistant.enable = true;
}
```
--
build and run in VM
```sh
nixos-generate --configuration ./config.nix \
--format vm --run
```
--
build sd card for Raspberry PI
```sh
nixos-generate --configuration ./config.nix \
--format sd-aarch64 --system aarch64-linux
```
---
# NixOS Containers
* *sub*configuration.nix
* mount folders
* creates a [systemd-nspawn](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html) container
--
## Main use-case
multiple instances of same service *(costs almost no overhead)*.
---
### NixOS Container Example
```nix
# creates a systemd service container@database96
containers.database96.config = { config, pkgs, ... }:
{
services.postgresql = {
enable = true;
package = pkgs.postgresql_9_6;
port = 5432;
}
};
# creates a systemd service container@database10
containers.database10.config = { config, pkgs, ... }:
{
services.postgresql = {
enable = true;
package = pkgs.postgresql_10;
port = 5433;
}
};
```
---
# There is MUUCH moar!
* [Home-Manager](https://github.com/rycee/home-manager) get rid of `.dot_file` mess.
* [NixOS-Shell](https://github.com/chrisfarms/nixos-shell) like `nix-shell` + NixOS modules.
* DevOps Tools : [NixOps](https://nixos.org/nixops/) and [krops](https://cgit.krebsco.de/krops/about/).
* [nix-review](https://github.com/Mic92/nix-review) pull-request review tool.
* [disko](https://cgit.krebsco.de/disko/about/) hard-drive setup.
* [simple-nixos-mailserver](https://gitlab.com/simple-nixos-mailserver/nixos-mailserver) a mailserver module.
* [TerraNix](https://github.com/mrVanDalo/terranix) generate [terraform](https://www.terraform.io/) configuration.
* [cabal2nix](https://github.com/NixOS/cabal2nix), [pypi2nix](https://github.com/garbas/pypi2nix), [elm2nix](https://github.com/hercules-ci/elm2nix) create `shell.nix` for programming languages.
---
# How to start?
You liked what you saw?
Can't wait to try it out?
## Virtual Machine
* download [VirtualBox Image](https://nixos.org/nixos/download.html)
* edit `/etc/nixos/configuration.nix`
* run `nixos-rebuild switch`
* get a feeling for it
* install a computer with your `/etc/nixos/configuration.nix`
---
## Keep in touch
* irc.freenode.net
* `#nixos`
* `#nixos-de`
* `#nixos-fr` ...
* [Discourse](https://discourse.nixos.org/)
* [NixOS weekly](https://weekly.nixos.org/)
* [Github](https://github.com/nixos)

24
src/lessc/page/color.less Normal file
View File

@ -0,0 +1,24 @@
@color-code-background: rgb(224, 224, 206);
@color-code-border: rgb(223, 210, 142);
@color-code-inline: rgb(22, 34, 0);
@color-note-background: rgb(182, 201, 182);
@color-note-border: rgb(172, 216, 132);
@color-warning-background: rgba(188, 32, 11, 0.55);
@color-comparison-good: #ABE953;
@color-comparison-ok: #E9E653;
@color-comparison-bad: #E96D53;
@color-nav-background: rgb(0, 0, 5);
@color-nav-text: rgb(255, 255, 255);
@color-nav-item-border: rgb(59, 206, 59);
@color-nav-item-border-active: rgb(213, 230, 62);
@color-sidebar-font: rgb(0, 0, 0);
@color-pages-list: rgb(159, 197, 159);
@color-pages-list-border: rgb(15, 49, 15);
@color-pages-list-text: rgb(0, 0, 0);

10
src/lessc/page/font.less Normal file
View File

@ -0,0 +1,10 @@
@font-normal: ~"'Roboto', sans-serif";
@font-code: ~"'Inconsolata', monospace";
@font-header: ~"'Zilla Slab', serif";
@font-height: 1.7em;
@font-code-height: 1.1em;
@font-sidebar: ~"'Abel', sans-serif";
@font-nav: ~"'Lato', sans-serif";

264
src/lessc/page/main.less Normal file
View File

@ -0,0 +1,264 @@
@import "color.less";
@import "media-types.less";
@import "font.less";
// left and right for notes and warning and and code blocks
@special-info-padding-side: 0.5em;
body {
margin: 0px;
#main-block{
padding-top: 49px;
font-family: @font-normal;
line-height: @font-height;
display: grid;
grid-template-columns: 1fr minmax(100px,800px) 1fr;
grid-template-areas:
". content sidebar";
}
.content {
font-family: @font-normal;
line-height: @font-height;
grid-area: content;
}
#main-navigation {
background-color: @color-nav-background;
position: fixed;
width:100%;
display: grid;
grid-template-columns: 1fr minmax(100px,800px) 1fr;
grid-template-areas:
". menu .";
ul {
grid-area: menu;
margin-top: 0px;
margin-bottom: 0px;
list-style-type: none;
padding: 0;
overflow: hidden;
background-color: @color-nav-background;
color: @color-nav-text;
li.active {
border-bottom: 3px solid @color-nav-item-border-active;
}
li {
float: left;
font-family: @font-nav;
border-bottom: 3px solid @color-nav-item-border;
a {
display: block;
text-align: center;
padding: 14px 16px;
text-decoration: none;
color: @color-nav-text;
}
}
}
}
}
// listings of articles
ul.pages-list{
list-style-type: none;
margin-left: .0em;
padding-left: .0em;
li {
a {
padding-left: 1.3em;
padding-right: 1.0em;
padding-top: 1.0em;
padding-bottom: 1.0em;
margin-top: 0.5em;
margin-bottom: 0em;
background-color: @color-pages-list;
border-left: 3px solid @color-pages-list-border;
display: block;
text-align: left;
text-decoration: none;
color: @color-pages-list-text;
h1,h2,h3,h4,h5 {
margin-top: 10px;
margin-bottom: 0px;
text-decoration: underline;
}
p {
margin-top: 10px;
}
}
}
}
@media @non-desktop {
body nav#TableOfContents {
display: none;
}
}
body {
nav#TableOfContents {
grid-area: sidebar;
font-family: @font-sidebar;
color: @color-sidebar-font;
> ul {
position: fixed;
}
ul {
list-style-type: none;
margin-left: .0em;
padding-left: .6em;
}
a:link,a:visited,a:active {
text-decoration: none;
color: @color-sidebar-font;
}
a:hover {
text-decoration: underline;
color: @color-sidebar-font;
}
}
}
.block-margin {
margin-top: .65em;
margin-bottom: .65em;
}
h1,h2,h3,h4 {
font-family: @font-header;
}
pre {
background: @color-code-background;
.block-margin();
margin-left: 0em;
margin-right: 0em;
padding-left: @special-info-padding-side ;
padding-top: .7em ;
padding-right: .0em;
padding-bottom: 0.7em;
border-left: .4em solid @color-code-border;
white-space: pre-wrap;
font-weight: normal;
font-family: @font-code;
line-height: @font-code-height;
code {
font-weight: normal;
font-family: @font-code;
line-height: @font-code-height;
}
code.nix {
background: @color-code-background;
}
}
.inline-code{
color: @color-code-inline;
font-weight: bold;
font-family: @font-code;
}
p > code {
.inline-code();
}
li > code {
.inline-code();
}
p {
.block-margin();
}
.panel {
background: @color-note-background;
border-left: .4em solid @color-note-border;
padding-left: 0px;
padding-top: .4em;
padding-bottom: .4em;
.block-margin();
p {
.block-margin();
margin-left: @special-info-padding-side;
padding-top: .0em;
padding-bottom: 0.0em;
}
pre {
background: @color-code-background;
.block-margin();
margin-left: 0;
padding-left: @special-info-padding-side * 2 ;
padding-right: @special-info-padding-side * 2 ;
padding-top: .6em;
padding-bottom: 0.4em;
border-left: none;
white-space: pre-wrap;
}
}
.warning {
background: @color-warning-background;
}
table.comparison {
width: 100%;
.block-margin();
margin-left: 0px;
margin-right: 0px;
.good {
background: @color-comparison-good;
text-align: center;
}
.bad {
background: @color-comparison-bad;
text-align: center;
}
.ok {
background: @color-comparison-ok;
text-align: center;
}
}

View File

@ -0,0 +1,4 @@
@desktop: ~"(min-width: 1180px)";
@non-desktop: ~"(max-width: 1200px)";

View File

@ -0,0 +1,18 @@
@color-yellow : #b58900;
@color-orange : #cb4b16;
@color-red : #dc322f;
@color-magenta: #d33682;
@color-violet : #6c71c4;
@color-blue : #268bd2;
@color-cyan : #2aa198;
@color-green : #859900;
@color-base03 : #002b36;
@color-base02 : #073642;
@color-base01 : #586e75;
@color-base00 : #657b83;
@color-base0 : #839496;
@color-base1 : #93a1a1;
@color-base2 : #eee8d5;
@color-base3 : #fdf6e3;

View File

@ -0,0 +1,18 @@
@color-yellow : #b58900;
@color-orange : #cb4b16;
@color-red : #dc322f;
@color-magenta: #d33682;
@color-violet : #6c71c4;
@color-blue : #268bd2;
@color-cyan : #2aa198;
@color-green : #859900;
@color-base03 : #fdf6e3;
@color-base02 : #eee8d5;
@color-base01 : #93a1a1;
@color-base00 : #839496;
@color-base0 : #657b83;
@color-base1 : #586e75;
@color-base2 : #073642;
@color-base3 : #002b36;

View File

@ -0,0 +1,47 @@
:root {
font-family: @font-family;
}
h1,h2,h3,h4,h5 {
font-family: @font-header;
color: @color-base1;
margin-bottom: .3em;
}
a {
text-decoration: none;
color: @color-blue;
&:visited{
color: @color-blue;
}
&:hover {
background-color: @color-blue;
color: @color-base03;
transition: color 300ms,background-color 300ms;
}
}
.remark-slide-content{
background-color: @color-base03;
color: @color-base2;
}
strong{
color: @color-violet;
}
em{
color: @color-cyan;
}
.remark-code, .remark-inline-code {
font-family: @font-code;
color: @color-yellow;
}
// pre {
// background-color: @color-base02;
// padding: .2em;
// border-radius: .5em;
// }

View File

@ -0,0 +1,8 @@
@import url('https://cdn.rawgit.com/tonsky/FiraCode/1.204/distr/fira_code.css');
@import url('https://fonts.googleapis.com/css?family=Roboto+Slab');
@import url('https://fonts.googleapis.com/css?family=Volkhov');
@font-family: 'Roboto Slab', serif;
@font-code: 'Fira Code';
@font-header: 'Volkhov', serif;

View File

@ -0,0 +1,3 @@
@import "./default.less";
@import "./color-solarized-dark.less";
@import "./font.less";

View File

@ -0,0 +1,3 @@
@import "./default.less";
@import "./color-solarized-light.less";
@import "./font.less";

18
static/js/remark-latest.min.js vendored Normal file

File diff suppressed because one or more lines are too long