feat: add static website
This commit is contained in:
parent
b714d906d8
commit
d4e8bde4cd
9 changed files with 110 additions and 11 deletions
19
flake.lock
generated
19
flake.lock
generated
|
|
@ -1137,7 +1137,8 @@
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"pre-commit-hooks": "pre-commit-hooks",
|
"pre-commit-hooks": "pre-commit-hooks",
|
||||||
"stable": "stable",
|
"stable": "stable",
|
||||||
"timers": "timers"
|
"timers": "timers",
|
||||||
|
"zola-theme": "zola-theme"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
|
|
@ -1402,6 +1403,22 @@
|
||||||
"repo": "xwayland-satellite",
|
"repo": "xwayland-satellite",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"zola-theme": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1745542545,
|
||||||
|
"narHash": "sha256-hXNJaz/F5t1ZwbCq61eMxoA8MlKZM8ZXoyMJb27+5QI=",
|
||||||
|
"owner": "Speyll",
|
||||||
|
"repo": "anemone",
|
||||||
|
"rev": "b5ecf8e3063c9e57c2d83b90ffd67b5037bba395",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Speyll",
|
||||||
|
"repo": "anemone",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
||||||
19
flake.nix
19
flake.nix
|
|
@ -57,6 +57,9 @@
|
||||||
# Firefox user.js
|
# Firefox user.js
|
||||||
arkenfox-userjs.url = "github:arkenfox/user.js";
|
arkenfox-userjs.url = "github:arkenfox/user.js";
|
||||||
arkenfox-userjs.flake = false;
|
arkenfox-userjs.flake = false;
|
||||||
|
|
||||||
|
zola-theme.url = "github:Speyll/anemone";
|
||||||
|
zola-theme.flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ {flake-parts, ...}:
|
outputs = inputs @ {flake-parts, ...}:
|
||||||
|
|
@ -78,10 +81,24 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
devShells.default = pkgs.mkShell {
|
devShells = rec {
|
||||||
|
default = pkgs.mkShell {
|
||||||
inherit (config.pre-commit.devShell) shellHook nativeBuildInputs;
|
inherit (config.pre-commit.devShell) shellHook nativeBuildInputs;
|
||||||
packages = [inputs'.clan-core.packages.clan-cli pkgs.alejandra];
|
packages = [inputs'.clan-core.packages.clan-cli pkgs.alejandra];
|
||||||
};
|
};
|
||||||
|
zola = let
|
||||||
|
theme = inputs.zola-theme;
|
||||||
|
themeName = (builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name;
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
inputsFrom = [default];
|
||||||
|
packages = [pkgs.zola];
|
||||||
|
shellHook = ''
|
||||||
|
mkdir themes
|
||||||
|
ln -s ${inputs.zola-theme} themes/${themeName}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
pre-commit.settings.hooks = {
|
pre-commit.settings.hooks = {
|
||||||
alejandra.enable = true;
|
alejandra.enable = true;
|
||||||
check-merge-conflicts.enable = true;
|
check-merge-conflicts.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
./reverse-proxy.nix
|
./reverse-proxy.nix
|
||||||
./ddns.nix
|
./ddns.nix
|
||||||
./mail-server.nix
|
./mail-server.nix
|
||||||
|
./website/root
|
||||||
];
|
];
|
||||||
|
|
||||||
time.timeZone = "Europe/Berlin";
|
time.timeZone = "Europe/Berlin";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
{config, ...}: {
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
services.fail2ban = {
|
services.fail2ban = {
|
||||||
enable = true;
|
enable = true;
|
||||||
bantime-increment.enable = true;
|
bantime-increment.enable = true;
|
||||||
|
|
@ -63,17 +67,17 @@
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
useACMEHost = "any.moritz.place";
|
useACMEHost = "any.moritz.place";
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
extraConfig = ''
|
return = "301 https://moritz.place";
|
||||||
add_header Content-Type text/html;
|
|
||||||
'';
|
|
||||||
return = "200 '<html><body>Hello World</body></html>'";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"moritz.place" = {
|
"moritz.place" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
useACMEHost = "moritz.place";
|
useACMEHost = "moritz.place";
|
||||||
locations."/" = {
|
locations."/" = lib.mkDefault {
|
||||||
return = "301 https://www.moritz.place";
|
extraConfig = ''
|
||||||
|
add_header Content-Type text/html;
|
||||||
|
'';
|
||||||
|
return = "200 '<html><body>Hello World</body></html>'";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"_" = {
|
"_" = {
|
||||||
|
|
|
||||||
1
machines/moritz-server/website/root/.envrc
Normal file
1
machines/moritz-server/website/root/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake .#zola --builders ""
|
||||||
1
machines/moritz-server/website/root/.gitignore
vendored
Normal file
1
machines/moritz-server/website/root/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
themes/
|
||||||
29
machines/moritz-server/website/root/config.toml
Normal file
29
machines/moritz-server/website/root/config.toml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# The URL the site will be built for
|
||||||
|
base_url = "https://moritz.place"
|
||||||
|
|
||||||
|
# The site title and description; used in feeds by default.
|
||||||
|
title = "Moritz Place on the Internet"
|
||||||
|
description = "Stay a while :)"
|
||||||
|
|
||||||
|
# Whether to automatically compile all Sass files in the sass directory
|
||||||
|
compile_sass = true
|
||||||
|
|
||||||
|
# Whether to build a search index to be used later on by a JavaScript library
|
||||||
|
build_search_index = true
|
||||||
|
|
||||||
|
# The site theme to use.
|
||||||
|
theme = "anemone"
|
||||||
|
|
||||||
|
[markdown]
|
||||||
|
# Whether to do syntax highlighting
|
||||||
|
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
|
||||||
|
highlight_code = true
|
||||||
|
|
||||||
|
[extra]
|
||||||
|
# Put all your custom variables here
|
||||||
|
header_nav = [
|
||||||
|
{ url = "/", name_en = "/home/"},
|
||||||
|
# { url = "/about", name_en = "/about/"},
|
||||||
|
# { url = "/journal", name_en = "/journal/"},
|
||||||
|
# { url = "/blog", name_en = "/blog/"}
|
||||||
|
]
|
||||||
3
machines/moritz-server/website/root/content/_index.md
Normal file
3
machines/moritz-server/website/root/content/_index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
+++
|
||||||
|
+++
|
||||||
|
Hello World!
|
||||||
26
machines/moritz-server/website/root/default.nix
Normal file
26
machines/moritz-server/website/root/default.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
theme = inputs.zola-theme;
|
||||||
|
themeName = (builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name;
|
||||||
|
package = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "static-website";
|
||||||
|
src = with lib.fileset;
|
||||||
|
toSource {
|
||||||
|
root = ./.;
|
||||||
|
fileset = difference (gitTracked ./.) (unions [./default.nix ./.envrc]);
|
||||||
|
};
|
||||||
|
nativeBuildInputs = [pkgs.zola];
|
||||||
|
configurePhase = ''
|
||||||
|
mkdir themes
|
||||||
|
ln -s ${theme} themes/${themeName}
|
||||||
|
'';
|
||||||
|
buildPhase = "zola build";
|
||||||
|
installPhase = "cp -r public $out";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
services.nginx.virtualHosts."moritz.place".locations."/".root = "${package}";
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue