Compare commits

...

29 Commits

Author SHA1 Message Date
7a0665a32e Updated developer experience and added placeholder 2024-03-03 14:28:15 +01:00
cd187e3092 updated blog flake 2024-03-02 19:36:04 +01:00
d2adef9dc0 changed to unstable branch 2024-03-02 18:39:38 +01:00
b6ee55af9f changed GPG key 2023-09-07 02:41:41 +02:00
81820ac7ea Added GPG Key 2023-09-05 17:01:06 +02:00
31a8f290b4 updated README 2023-08-18 22:32:57 +02:00
6737d9981c updated build 2023-08-18 22:32:36 +02:00
356e87d48f deleted 2023-08-18 22:32:19 +02:00
4232531d31 test 2023-08-18 19:48:39 +02:00
6aa91bd58c renamed 2023-08-18 19:42:08 +02:00
3c4d9460fc removed container 2023-08-18 19:32:12 +02:00
542f8a61bc added install-nix 2023-08-18 19:29:37 +02:00
826cf0b36c allowed insecure node to be installed 2023-08-18 19:20:52 +02:00
04b86982b4 added nix channel 2023-08-18 19:18:40 +02:00
bed207e627 added node dependency 2023-08-18 19:14:30 +02:00
09726bf3e9 pls fix 2023-08-18 19:04:40 +02:00
333f4e87a8 fixed image 2023-08-18 18:58:15 +02:00
d47d3a3f34 updated workflow 2023-08-18 18:56:57 +02:00
bf3ee85df5 For deployment with GitHub 2023-08-18 18:38:49 +02:00
b5c6e9fa7b added formatter 2023-08-18 01:02:41 +02:00
b2448de276 removed asciidoc support 2023-08-17 22:50:29 +02:00
23dd549367 removed 2023-08-17 21:54:33 +02:00
e29c65ee2d updated README 2023-08-17 21:54:03 +02:00
7e8d3e5086 changed name of flake project 2023-08-17 21:50:16 +02:00
957bf5ace7 changed menu 2023-08-17 21:46:58 +02:00
f1404c7061 moved to data 2023-08-17 21:46:43 +02:00
7aec8a83e7 added asciidoc support 2023-08-17 21:43:24 +02:00
a432bbfcf4 changed to publish 2023-08-17 20:07:30 +02:00
680fa49134 test 2023-08-17 19:58:37 +02:00
11 changed files with 229 additions and 183 deletions

64
.github/workflows/blog.yaml vendored Normal file
View File

@ -0,0 +1,64 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Build and deploy site to GitHub Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build with Nix
run: "nix build"
- name: Copy public folder
run: "cp -r result/. public/"
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./public
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

18
.gitignore vendored
View File

@ -1,13 +1,11 @@
# Nix build output
/result
# development
/.direnv/
/themes
# Generated files by hugo
/public/
/resources/_gen/
/assets/jsconfig.json
hugo_stats.json
# Temporary lock file while building
/resources/
/.hugo_build.lock
# Nix
.direnv/
/result
/themes/

View File

@ -1,24 +1,16 @@
# Deploying to nginx webserver
# Kristian's Reproducible Website
Adapted from [AveryanAlex's blog](https://averyan.ru/en/p/nix-flakes-hugo)
[![GitHub Pages Status](https://github.com/Krsnik/blog/actions/workflows/blog.yaml/badge.svg)](https://github.com/Krsnik/blog/actions/workflows/blog.yaml)
```nix
{
inputs.blog.url = "git+https://git.krsnik.at/Kristian/blog"
}
```
This project is my personal website, using Hugo with asciidoc as a static site generator.
The site is hosted on GitLab pages, using the supplied `.gitlab-ci.yaml` file, which just builds the `flake.nix` file.
Setup nginx virtualHost to serve your site:
## Development
```nix
{ inputs, pkgs, ... }:
{
services.nginx.virtualHosts."blog.krsnik.at" = {
root = inputs.packages.default.${pkgs.hostPlatform.system};
ssl = {
enableACME = true;
forceSSL = true;
};
};
}
```
To preview changes serve the website with `hugo serve -D`. This will build all content that has `draf: true` set in the header.
This will also build the theme's content, if it includes one.
If you are only interested how the published site will look do `hugo serve`.
## Deployment
This repo includes CI/CD configurations for GitHub and GitLab, so all you need to do is push any changes.

View File

@ -1,36 +1,41 @@
baseURL = 'https://krezzlu.gitlab.io/blog'
baseURL = 'https://blog.krsnik.at'
languageCode = 'en-us'
title = "Kristian's Blog"
theme = 'nostyleplease'
[markup]
[markup.goldmark]
[markup.goldmark.parser]
[markup.goldmark.parser.attribute]
block = true
title = true
[markup.highlight]
anchorLineNos = false
codeFences = true
guessSyntax = true
hl_Lines = ''
hl_inline = false
lineAnchors = ''
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
noClasses = true
noHl = false
style = 'rtt'
tabWidth = 4
[markup.tableOfContents]
startLevel = 2
endLevel = 3
ordered = false
[params]
[params.theme_config]
appearance = "auto"
back_home_text = "$HOME"
date_format = "2006-01-02"
[params.theme_config]
appearance = "auto"
back_home_text = "$HOME"
date_format = "2006-01-02"
[security.exec]
allow = ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$']
[markup]
[markup.goldmark]
[markup.goldmark.parser]
[markup.goldmark.parser.attribute]
block = true
title = true
[markup.highlight]
anchorLineNos = false
codeFences = true
guessSyntax = true
hl_Lines = ''
hl_inline = false
lineAnchors = ''
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
noClasses = true
noHl = false
style = 'rtt'
tabWidth = 4
[markup.tableOfContents]
startLevel = 2
endLevel = 3
ordered = false

6
content/posts/example.md Normal file
View File

@ -0,0 +1,6 @@
---
title: "Example"
date: 2024-03-03T14:27:40+01:00
draft: true
---

View File

@ -1,7 +0,0 @@
---
title: "My First Post"
date: 2023-08-17T15:49:41+02:00
draft: true
---
## This is a test

24
data/menu.toml Normal file
View File

@ -0,0 +1,24 @@
[[entries]]
title = "me"
[[entries.entries]]
title = "email: <a href='mailto:contact@krsnik.at'>contact@krsnik.at</a>"
[[entries.entries]]
title = "gpg: <a href='/gpg.txt'>2DC7 B611 6CFE B225 0B01 5EB4 F91B CD4C AEBD 1403</a>"
[[entries]]
title = "rss"
url = "index.xml"
[[entries]]
title = "posts"
[entries.post_list]
limit = 0
show_more = true
show_more_text = "See archive..."
show_more_url = "posts"
[[entries]]
title = "theme used: <a href='https://github.com/Masellum/hugo-theme-nostyleplease'>no style, please!</a>"

42
flake.lock generated
View File

@ -1,35 +1,17 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1692207601,
"narHash": "sha256-tfPGNKQcJT1cvT6ufqO/7ydYNL6mcJClvzbrzhKjB80=",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b30c68669df77d981ce4aefd6b9d378563f6fc4e",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -52,25 +34,9 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nostyleplease": "nostyleplease"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -1,9 +1,8 @@
{
description = "A very basic flake";
description = "Kristian's Website";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nostyleplease = {
url = "github:Masellum/hugo-theme-nostyleplease";
flake = false;
@ -13,47 +12,68 @@
outputs = {
self,
nixpkgs,
flake-utils,
nostyleplease,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.default = pkgs.stdenv.mkDerivation {
}: let
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in {
formatter = forAllSystems (system: pkgs.${system}.alejandra);
packages = forAllSystems (system: {
default = pkgs.${system}.stdenv.mkDerivation {
name = "blog";
meta = with pkgs.lib; {
description = "Kristian's personal blog";
platforms = platforms.all;
};
# Exclude themes and public folder from build sources
src = builtins.filterSource (path: type:
!(type
== "directory"
&& (baseNameOf path == "themes" || baseNameOf path == "public")))
./.;
src = builtins.filterSource (path: type: !(type == "directory" && (baseNameOf path == "themes" || baseNameOf path == "public"))) ./.;
nativeBuildInputs = with pkgs.${system}; [
hugo
];
# Link theme to themes folder and build
buildPhase = ''
mkdir -p themes
ln -s ${nostyleplease} themes/nostyleplease
${pkgs.hugo}/bin/hugo --gc --minify
hugo --gc --minify
'';
installPhase = ''
cp -r public/. $out
'';
};
});
devShells = forAllSystems (system: {
default = pkgs.${system}.mkShellNoCC {
packages = with pkgs.${system}; [
hugo
];
devShells.default = pkgs.mkShellNoCC {
packages = with pkgs; [hugo];
# Link theme to themes folder
shellHook = ''
mkdir -p themes
unlink themes/nostyleplease
ln -s ${nostyleplease} themes/nostyleplease
if [ ! -d ./themes ]; then
mkdir ./themes
fi
if [ ! -d ./themes/nostyleplease ]; then
ln -s ${nostyleplease} ./themes/nostyleplease
fi
alias new='hugo new content'
alias serve='hugo serve --buildDrafts'
greeter_text="
* Create new content with:
new posts/name-of-post.md
* Render drafts with:
serve
"
echo "$greeter_text"
'';
};
});
};
}

View File

@ -1,53 +0,0 @@
[[entries]]
title = "info"
[[entries.entries]]
title = "Does this work <a href='https://github.com/riggraz/no-style-please'>riggraz/no-style-please</a>."
[[entries.entries]]
title = "github repo"
url = "https://github.com/riggraz/no-style-please"
[[entries.entries]]
title = "used by <a href='https://riggraz.dev'>riggraz.dev</a> and <a href='https://github.com/riggraz/no-style-please/network/dependents'>many others</a>"
[[entries]]
title = "all posts"
[entries.post_list]
limit = 5
show_more = true
show_more_text = "See archive..."
show_more_url = "posts"
[[entries]]
title = "posts by category"
[entries.post_list]
section = "posts"
show_more = true
show_more_text = "See more posts..."
show_more_url = "posts"
[[entries]]
title = "rss"
url = "index.xml"
[[entries]]
title = "another list"
[[entries.entries]]
title = "with subitems"
[[entries.entries.entries]]
title = "with subsubitems"
[[entries.entries.entries]]
title = "example page"
url = "about"
[[entries]]
title = "PRO TIP"
entries = [
{ title = "to edit this menu, edit data/menu.toml file" }
]

31
static/gpg.txt Normal file
View File

@ -0,0 +1,31 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZPkCFBYJKwYBBAHaRw8BAQdAD0+J1CXMmFUCPJWY+fgBnl/Cht1PW21hzPlj
haSad8K0JEtyaXN0aWFuIEtyc25payA8a3Jpc3RpYW5Aa3JzbmlrLmF0PoiXBBMW
CgA/AhsBBQkA7U4ABAsJCAcEFQoJCAUWAgMBAAIeBQIXgBYhBC3HthFs/rIlCwFe
tPkbzUyuvRQDBQJk+QMmAhkBAAoJEPkbzUyuvRQD+LMBAKPBtXfJIbwbqyboiXFC
faryVCNA51Pm07OJRy7HaHQOAP4or9JrgxE6a16tVlYj3F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