Compare commits

..

10 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
8 changed files with 102 additions and 76 deletions

View File

@ -1,5 +1,5 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages # Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages name: Build and deploy site to GitHub Pages
on: on:
# Runs on pushes targeting the default branch # Runs on pushes targeting the default branch

18
.gitignore vendored
View File

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

View File

@ -1,12 +1,16 @@
# Kristian's Reproducible Website # Kristian's Reproducible Website
[![GitHub Pages Status](https://github.com/Krsnik/blog/actions/workflows/blog.yaml/badge.svg)](https://github.com/Krsnik/blog/actions/workflows/blog.yaml)
This project is my personal website, using Hugo with asciidoc as a static site generator. 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. The site is hosted on GitLab pages, using the supplied `.gitlab-ci.yaml` file, which just builds the `flake.nix` file.
## Development ## 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 ## 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
View File

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

View File

@ -4,6 +4,9 @@ title = "me"
[[entries.entries]] [[entries.entries]]
title = "email: <a href='mailto:contact@krsnik.at'>contact@krsnik.at</a>" 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]] [[entries]]
title = "rss" title = "rss"
url = "index.xml" url = "index.xml"

42
flake.lock generated
View File

@ -1,35 +1,17 @@
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1692207601, "lastModified": 1709237383,
"narHash": "sha256-tfPGNKQcJT1cvT6ufqO/7ydYNL6mcJClvzbrzhKjB80=", "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b30c68669df77d981ce4aefd6b9d378563f6fc4e", "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.05", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -52,25 +34,9 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nostyleplease": "nostyleplease" "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", "root": "root",

View File

@ -2,8 +2,7 @@
description = "Kristian's Website"; description = "Kristian's Website";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nostyleplease = { nostyleplease = {
url = "github:Masellum/hugo-theme-nostyleplease"; url = "github:Masellum/hugo-theme-nostyleplease";
flake = false; flake = false;
@ -13,49 +12,68 @@
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
flake-utils,
nostyleplease, nostyleplease,
}: }: let
flake-utils.lib.eachDefaultSystem (system: let supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
pkgs = nixpkgs.legacyPackages.${system}; forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in { in {
formatter = pkgs.alejandra; formatter = forAllSystems (system: pkgs.${system}.alejandra);
packages.default = pkgs.stdenv.mkDerivation { packages = forAllSystems (system: {
default = pkgs.${system}.stdenv.mkDerivation {
name = "blog"; name = "blog";
meta = with pkgs.lib; {
description = "Kristian's personal blog";
platforms = platforms.all;
};
# Exclude themes and public folder from build sources # Exclude themes and public folder from build sources
src = builtins.filterSource (path: type: src = builtins.filterSource (path: type: !(type == "directory" && (baseNameOf path == "themes" || baseNameOf path == "public"))) ./.;
!(type
== "directory" nativeBuildInputs = with pkgs.${system}; [
&& (baseNameOf path == "themes" || baseNameOf path == "public"))) hugo
./.; ];
# Link theme to themes folder and build # Link theme to themes folder and build
buildPhase = '' buildPhase = ''
mkdir -p themes mkdir -p themes
ln -s ${nostyleplease} themes/nostyleplease ln -s ${nostyleplease} themes/nostyleplease
${pkgs.hugo}/bin/hugo --gc --minify hugo --gc --minify
''; '';
installPhase = '' installPhase = ''
cp -r public/. $out 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 # Link theme to themes folder
shellHook = '' shellHook = ''
mkdir -p themes if [ ! -d ./themes ]; then
unlink themes/nostyleplease mkdir ./themes
ln -s ${nostyleplease} themes/nostyleplease 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
View File

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