Compare commits
19 Commits
b5c6e9fa7b
...
main
Author | SHA1 | Date | |
---|---|---|---|
7a0665a32e
|
|||
cd187e3092
|
|||
d2adef9dc0
|
|||
b6ee55af9f
|
|||
81820ac7ea | |||
31a8f290b4 | |||
6737d9981c | |||
356e87d48f | |||
4232531d31 | |||
6aa91bd58c | |||
3c4d9460fc | |||
542f8a61bc | |||
826cf0b36c | |||
04b86982b4 | |||
bed207e627 | |||
09726bf3e9 | |||
333f4e87a8 | |||
d47d3a3f34 | |||
bf3ee85df5 |
64
.github/workflows/blog.yaml
vendored
Normal file
64
.github/workflows/blog.yaml
vendored
Normal 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
18
.gitignore
vendored
@ -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/
|
@ -1,12 +1,16 @@
|
||||
# Kristian's Reproducible Website
|
||||
|
||||
[](https://github.com/Krsnik/blog/actions/workflows/blog.yaml)
|
||||
|
||||
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.
|
||||
|
||||
## Development
|
||||
|
||||
To preview changes serve the website with `hugo serve` and set `draft: false` in your blogpost.
|
||||
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
|
||||
|
||||
Just push the changes to GitLab and the automatic CI/CD will build and deploy the website.
|
||||
This repo includes CI/CD configurations for GitHub and GitLab, so all you need to do is push any changes.
|
||||
|
6
content/posts/example.md
Normal file
6
content/posts/example.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: "Example"
|
||||
date: 2024-03-03T14:27:40+01:00
|
||||
draft: true
|
||||
---
|
||||
|
@ -4,6 +4,9 @@ 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"
|
||||
|
42
flake.lock
generated
42
flake.lock
generated
@ -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",
|
||||
|
68
flake.nix
68
flake.nix
@ -2,8 +2,7 @@
|
||||
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,49 +12,68 @@
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
nostyleplease,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
formatter = pkgs.alejandra;
|
||||
}: 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.default = pkgs.stdenv.mkDerivation {
|
||||
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"
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
31
static/gpg.txt
Normal file
31
static/gpg.txt
Normal file
@ -0,0 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MFAmT5AlYCGwIFCQDtTgAAgQkQ+RvN
|
||||
TK69FAN2IAQZFgoAHRYhBJALUaFigfDtqhbZNf0TMKyfkJ6FBQJk+QJWAAoJEP0T
|
||||
MKyfkJ6F8VgBAPSQxcKWiMuu+kgwpGacdRJye5VnxbDAmTDN0o7ihdbeAPkB9U3i
|
||||
nhGVTJHg4AwApSn+lpNkB7FXOHxAhjNzPPwDC7v9AP4zvma9tJ3xfw04by40wteN
|
||||
A1ZrNGzFrs8qZuGOLd8oDQD/XD4X4wlKw9fTaJ/jRlPsCWAUN/epvvEmRTy6VeF/
|
||||
bQ64OARk+QJxEgorBgEEAZdVAQUBAQdAMMgPe1zRyRGYwg15BGIffM9d0tagKtjn
|
||||
cWXThzagsEsDAQgHiH4EGBYKACYWIQQtx7YRbP6yJQsBXrT5G81Mrr0UAwUCZPkC
|
||||
cQIbDAUJAO1OAAAKCRD5G81Mrr0UA+HDAP9ys54NPm2M5GiPqtSnIrm5lKs2wYUI
|
||||
CkfjX/iPgIhMaAD/Zdx6RtI3M4dGTQ10WNLjx6b27bEBI4WyBHlTjvDtMge4MwRk
|
||||
+QKLFgkrBgEEAdpHDwEBB0DjiXTbK1mQYcLAwTVMFJTMvqaP082imCBh3WGoEWoy
|
||||
toh+BBgWCgAmFiEELce2EWz+siULAV60+RvNTK69FAMFAmT5AosCGyAFCQDtTgAA
|
||||
CgkQ+RvNTK69FANvJgD+LHpCT20AowDgM0FqMyDWLpvn2XeILxusJGjZ+bxpycUB
|
||||
APqO5oAZWCfT4DaguqDX9S4BNeoSuxzyMriiIMQSzG0G
|
||||
=7G1z
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
Reference in New Issue
Block a user