From 3b76863b673e14bbb20d2fb81de727c72259b25e Mon Sep 17 00:00:00 2001 From: jamie Date: Thu, 23 Oct 2025 11:43:03 +0100 Subject: refactor: neaten up source tree --- .github/workflows/publish.yml | 9 +- 404.html | 9 - assets/css/default.scss | 274 -------------------- assets/css/syntax.scss | 243 ------------------ assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf | Bin 34320 -> 0 bytes assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf | Bin 48064 -> 0 bytes assets/images/converter.webp | Bin 18080 -> 0 bytes assets/images/erebus.webp | Bin 17652 -> 0 bytes assets/images/favicon.ico | Bin 14098 -> 0 bytes assets/images/noise.png | Bin 26039 -> 0 bytes assets/images/nonbinary-flag.svg | 21 -- flake.nix | 80 ++++-- index.html | 97 -------- pages/playlists.html | 57 ----- posts/2025-06-20-vr-plus-nixos-plus-nvidia.md | 128 ---------- site.hs | 155 ------------ skiletro.cabal | 15 -- src/404.html | 9 + src/assets/css/default.scss | 276 +++++++++++++++++++++ src/assets/css/syntax.scss | 243 ++++++++++++++++++ .../fonts/AtkinsonHyperlegibleMono-Regular.ttf | Bin 0 -> 34320 bytes .../fonts/AtkinsonHyperlegibleNext-Regular.ttf | Bin 0 -> 48064 bytes src/assets/images/converter.webp | Bin 0 -> 18080 bytes src/assets/images/erebus.webp | Bin 0 -> 17652 bytes src/assets/images/favicon.ico | Bin 0 -> 14098 bytes src/assets/images/noise.png | Bin 0 -> 26039 bytes src/assets/images/nonbinary-flag.svg | 21 ++ src/index.html | 97 ++++++++ src/pages/playlists.html | 57 +++++ src/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md | 130 ++++++++++ src/templates/archive.html | 3 + src/templates/default.html | 97 ++++++++ src/templates/post-list.html | 5 + src/templates/post.html | 7 + ssg/Main.hs | 151 +++++++++++ ssg/ssg.cabal | 15 ++ templates/archive.html | 3 - templates/default.html | 95 ------- templates/post-list.html | 5 - templates/post.html | 7 - 40 files changed, 1166 insertions(+), 1143 deletions(-) delete mode 100644 404.html delete mode 100644 assets/css/default.scss delete mode 100644 assets/css/syntax.scss delete mode 100644 assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf delete mode 100644 assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf delete mode 100644 assets/images/converter.webp delete mode 100644 assets/images/erebus.webp delete mode 100644 assets/images/favicon.ico delete mode 100644 assets/images/noise.png delete mode 100644 assets/images/nonbinary-flag.svg delete mode 100644 index.html delete mode 100644 pages/playlists.html delete mode 100644 posts/2025-06-20-vr-plus-nixos-plus-nvidia.md delete mode 100644 site.hs delete mode 100644 skiletro.cabal create mode 100644 src/404.html create mode 100644 src/assets/css/default.scss create mode 100644 src/assets/css/syntax.scss create mode 100644 src/assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf create mode 100644 src/assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf create mode 100644 src/assets/images/converter.webp create mode 100644 src/assets/images/erebus.webp create mode 100644 src/assets/images/favicon.ico create mode 100644 src/assets/images/noise.png create mode 100644 src/assets/images/nonbinary-flag.svg create mode 100644 src/index.html create mode 100644 src/pages/playlists.html create mode 100644 src/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md create mode 100644 src/templates/archive.html create mode 100644 src/templates/default.html create mode 100644 src/templates/post-list.html create mode 100644 src/templates/post.html create mode 100644 ssg/Main.hs create mode 100644 ssg/ssg.cabal delete mode 100644 templates/archive.html delete mode 100644 templates/default.html delete mode 100644 templates/post-list.html delete mode 100644 templates/post.html diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1d297d8..c7c1e63 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,11 +17,6 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Install Act Dependencies - if: ${{ env.ACT }} - run: | - apt-get update && apt-get install sudo -y - - name: Checkout uses: actions/checkout@v4 @@ -31,7 +26,7 @@ jobs: github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Build Site using Hakyll - run: nix run .# build + run: nix run .# - name: Setup Pages id: pages @@ -40,7 +35,7 @@ jobs: - name: Upload Artifact uses: actions/upload-pages-artifact@v3 with: - path: ./_site + path: ./results/dist deploy: environment: diff --git a/404.html b/404.html deleted file mode 100644 index 4bbf02f..0000000 --- a/404.html +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: 404 Not Found ---- - -

The page you requested cannot be found.

- -

- Click here to return back to the home page. -

diff --git a/assets/css/default.scss b/assets/css/default.scss deleted file mode 100644 index 26d0937..0000000 --- a/assets/css/default.scss +++ /dev/null @@ -1,274 +0,0 @@ -// VARIABLES AND IMPORTS -// --------------------------------------------------------------------------- - -$clr-bg: oklch(22.49% 0.008 297.21); -$clr-fg: oklch(98.51% 0 0); -$clr-primary: oklch(82.67% 0.096 307.5); -$clr-secondary: oklch(from $clr-primary l c 240); // hue-shifted copy - -$gap: 1rem; -$max-width: 50rem; -$mobile: 980px; - -@import "syntax"; - -// MIXINS -// --------------------------------------------------------------------------- - -@mixin phone-only { - @media (max-width: $mobile) { - @content; - } -} - -@mixin std-block { - display: block; - margin: 0; -} - -// GLOBAL RESET & TYPOGRAPHY -// --------------------------------------------------------------------------- - -*, -*::before, -*::after { - box-sizing: border-box; -} - -* { - padding: 0; - margin: 0; - transition: .1s ease-in-out; - font-family: "Atkinson Hyperlegible Next", sans-serif; - font-optical-sizing: auto; - text-transform: lowercase; -} - -html { - font-size: 16px; -} - -// 1rem base - -body { - display: flex; - flex-direction: column; - align-items: center; - gap: $gap; - padding: 5rem $gap $gap; - overflow-x: hidden; - color: $clr-fg; - background-color: black; - background: url("/assets/images/noise.png"), - radial-gradient(circle at center, $clr-bg, transparent), - radial-gradient(circle at bottom left, #27577D, transparent), - radial-gradient(circle at top right, #952EA4 0%, transparent), - radial-gradient(circle at center right, #6949A5 0%, transparent), - radial-gradient(circle at top center, #336BA0 0%, transparent); - background-attachment: fixed; -} - -// LAYOUT WRAPPER -// --------------------------------------------------------------------------- - -body>* { - // every top-level section - display: flex; - flex-direction: column; - gap: $gap; - width: 100%; - max-width: $max-width; - padding: 1.5rem 2.5rem; - background: $clr-bg; - outline: .2rem solid $clr-bg; - outline-offset: .2rem; -} - -@include phone-only { - body { - padding: 0; - gap: .2rem; - } - - body>* { - outline: 0; - } -} - -// NAVIGATION -// --------------------------------------------------------------------------- - -nav { - position: fixed; - transform: translateX(28rem); - display: flex; - flex-direction: column; - align-items: center; - gap: $gap; - padding: 1rem 2rem; - width: 0rem; - - svg { - width: 2rem; - height: 2rem; - fill: $clr-fg; - } - - a { - writing-mode: vertical-rl; - text-orientation: sideways; - text-decoration: none; - color: $clr-fg; - } - - hr { - width: 100%; - } -} - -@include phone-only { - nav { - position: static; - transform: none; - flex-direction: row; - justify-content: space-between; - width: 100%; - - a { - writing-mode: horizontal-tb; - } - - hr { - display: none; - } - } -} - -// TYPOGRAPHIC ELEMENTS -// --------------------------------------------------------------------------- - -p, -ul, -span { - font-size: 1.2rem; - text-align: justify; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - @include std-block; - padding-top: .5rem; - font-size: 1.75rem; -} - -// auto-generate heading prefixes -@for $i from 1 through 6 { - h#{$i}::before { - $hashes: ""; - - @for $_ from 1 through $i { - $hashes: $hashes + "#" - } - - content: "#{$hashes} "; - color: oklch(82.67% .087 #{280 + ($i - 1) * 40}); - } -} - -// LISTS -// --------------------------------------------------------------------------- - -ul { - display: flex; - flex-direction: column; - gap: .5rem; - list-style: none; - - li::before { - content: "~"; - padding: 0 .25rem 0 .5rem; - color: oklch(82.67% .087 180); - } -} - -// rainbow list items -@for $i from 1 through 15 { - ul li:nth-child(n+#{$i})::before { - color: oklch(82.67% .087 #{100 + ($i - 1) * 80}); - } -} - -// LINKS & MISC -// --------------------------------------------------------------------------- - -a { - color: $clr-primary; - - &:hover { - filter: brightness(.75); - } -} - -hr { - $c: oklch(from $clr-fg .45 c h); - background: $c; - border-color: $c; -} - -img { - user-select: none; -} - -address { - opacity: .5; - text-align: right; - margin-top: -2.1lh; - margin-bottom: .5rem; -} - -footer { - gap: 0; - - >* { - text-align: center; - font-size: 1rem; - opacity: .5; - } -} - -// CODE BLOCKS -// --------------------------------------------------------------------------- - -div.sourceCode { - padding: .2rem; - overflow: hidden; - font-family: "Atkinson Hyperlegible Mono", monospace; - background-color: black; - background: url("/images/noise.png"), - radial-gradient(circle at center, $clr-bg, transparent), - radial-gradient(circle at bottom left, #27577D, transparent), - radial-gradient(circle at top right, #952EA4 0%, transparent), - radial-gradient(circle at center right, #6949A5 0%, transparent), - radial-gradient(circle at top center, #336BA0 0%, transparent); - background-attachment: scroll; - - outline: 0.2rem solid $clr-bg; - outline-offset: 0.2rem; - - >* { - background: $clr-bg; - background-attachment: fixed; - padding: 1.2rem; - overflow: auto; - } - - * { - font-family: "Atkinson Hyperlegible Mono", monospace; - text-transform: none; - font-size: 1.05rem; - } -} \ No newline at end of file diff --git a/assets/css/syntax.scss b/assets/css/syntax.scss deleted file mode 100644 index 42be310..0000000 --- a/assets/css/syntax.scss +++ /dev/null @@ -1,243 +0,0 @@ -a.sourceLine { - display: inline-block; - line-height: 1.25; -} - -a.sourceLine { - pointer-events: none; - color: inherit; - text-decoration: inherit; -} - -a.sourceLine:empty { - height: 1.2em; -} - -.sourceCode { - overflow: visible; -} - -code.sourceCode { - white-space: pre; - position: relative; -} - -div.sourceCode { - margin: 1em 0; -} - -pre.sourceCode { - margin: 0; -} - -@media screen { - div.sourceCode { - overflow: auto; - } -} - -@media print { - code.sourceCode { - white-space: pre-wrap; - } - - a.sourceLine { - text-indent: -1em; - padding-left: 1em; - } -} - -pre.numberSource a.sourceLine { - position: relative; - left: -4em; -} - -pre.numberSource a.sourceLine::before { - content: attr(title); - position: relative; - left: -1em; - text-align: right; - vertical-align: baseline; - border: none; - pointer-events: all; - display: inline-block; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - padding: 0 4px; - width: 4em; - color: #aaaaaa; -} - -pre.numberSource { - margin-left: 3em; - border-left: 1px solid #aaaaaa; - padding-left: 4px; -} - -div.sourceCode { -} - -@media screen { - a.sourceLine::before { - text-decoration: underline; - } -} - -code span.al { - color: #f85858; - font-weight: bold; -} - -/* Alert */ -code span.an { - color: #3dddd8; - font-weight: bold; - font-style: italic; -} - -/* Annotation */ -code span.at { - color: #2ac68e; -} - -/* Attribute */ -code span.bn { - color: #2ac68e; -} - -/* BaseN */ -code span.bu { -} - -/* BuiltIn */ -code span.cf { - color: #2ac68e; - font-weight: bold; -} - -/* ControlFlow */ -code span.ch { - color: #008ce3; -} - -/* Char */ -code span.cn { - color: #f85858; -} - -/* Constant */ -code span.co { - color: #3dddd8; - font-style: italic; -} - -/* Comment */ -code span.cv { - color: #3dddd8; - font-weight: bold; - font-style: italic; -} - -/* CommentVar */ -code span.do { - color: #f85858; - font-style: italic; -} - -/* Documentation */ -code span.dt { - color: #f85858; -} - -/* DataType */ -code span.dv { - color: #2ac68e; -} - -/* DecVal */ -code span.er { - color: #f85858; - font-weight: bold; -} - -/* Error */ -code span.ex { -} - -/* Extension */ -code span.fl { - color: #40a070; -} - -/* Float */ -code span.fu { - color: #008ce3; -} - -/* Function */ -code span.im { -} - -/* Import */ -code span.in { - color: #3dddd8; - font-weight: bold; - font-style: italic; -} - -/* Information */ -code span.kw { - color: #2ac68e; - font-weight: bold; -} - -/* Keyword */ -code span.op { - color: #aaaaaa; -} - -/* Operator */ -code span.ot { - color: #2ac68e; -} - -/* Other */ -code span.pp { - color: #ff8a00; -} - -/* Preprocessor */ -code span.sc { - color: #4070a0; -} - -/* SpecialChar */ -code span.ss { - color: #008ce3; -} - -/* SpecialString */ -code span.st { - color: #008ce3; -} - -/* String */ -code span.va { - color: #008ce3; -} - -/* Variable */ -code span.vs { - color: #008ce3; -} - -/* VerbatimString */ -code span.wa { - color: #3dddd8; - font-weight: bold; - font-style: italic; -} diff --git a/assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf b/assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf deleted file mode 100644 index 157d62e..0000000 Binary files a/assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf and /dev/null differ diff --git a/assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf b/assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf deleted file mode 100644 index 3fa771f..0000000 Binary files a/assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf and /dev/null differ diff --git a/assets/images/converter.webp b/assets/images/converter.webp deleted file mode 100644 index 36764fa..0000000 Binary files a/assets/images/converter.webp and /dev/null differ diff --git a/assets/images/erebus.webp b/assets/images/erebus.webp deleted file mode 100644 index 510545e..0000000 Binary files a/assets/images/erebus.webp and /dev/null differ diff --git a/assets/images/favicon.ico b/assets/images/favicon.ico deleted file mode 100644 index 5000bb7..0000000 Binary files a/assets/images/favicon.ico and /dev/null differ diff --git a/assets/images/noise.png b/assets/images/noise.png deleted file mode 100644 index 93c1ad7..0000000 Binary files a/assets/images/noise.png and /dev/null differ diff --git a/assets/images/nonbinary-flag.svg b/assets/images/nonbinary-flag.svg deleted file mode 100644 index 5252870..0000000 --- a/assets/images/nonbinary-flag.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/flake.nix b/flake.nix index ee12ea0..704bb00 100644 --- a/flake.nix +++ b/flake.nix @@ -5,8 +5,13 @@ haskell-flake.url = "github:srid/haskell-flake"; # https://community.flake.parts/haskell-flake treefmt-nix.url = "github:numtide/treefmt-nix"; }; - outputs = inputs @ {flake-parts, ...}: - flake-parts.lib.mkFlake {inherit inputs;} { + outputs = + inputs@{ + self, + flake-parts, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" "aarch64-linux" @@ -17,35 +22,56 @@ inputs.treefmt-nix.flakeModule ]; - perSystem = { - self', - pkgs, - ... - }: { - haskellProjects.default = { - devShell = { - enable = true; - tools = hp: {inherit (hp) hakyll;}; - hlsCheck.enable = true; - mkShellArgs = { - buildInputs = with pkgs; [just sass]; - shellHook = "just -l -u"; + perSystem = + { + self', + pkgs, + lib, + ... + }: + { + packages.default = pkgs.stdenvNoCC.mkDerivation { + name = "website"; + src = ./src; + + GIT_REVISION = if (self ? shortRev) then self.shortRev else "dirty"; + + buildPhase = '' + ${lib.getExe self'.packages.ssg} build --verbose + ''; + + installPhase = '' + mkdir -p $out/dist + cp -a _site/. $out/dist + ''; + }; + + haskellProjects.default = { + projectRoot = ./ssg; + devShell = { + enable = true; + tools = hp: { inherit (hp) hakyll; }; + hlsCheck.enable = true; + mkShellArgs = { + buildInputs = with pkgs; [ + just + sass + ]; + shellHook = "just -l -u"; + }; }; }; - }; - treefmt = { - flakeCheck = true; - programs = { - alejandra.enable = true; - deadnix.enable = true; - just.enable = true; - prettier.enable = true; - stylish-haskell.enable = true; + treefmt = { + flakeCheck = true; + programs = { + nixfmt.enable = true; + deadnix.enable = true; + just.enable = true; + prettier.enable = true; + stylish-haskell.enable = true; + }; }; }; - - packages.default = self'.packages.skiletro; # haskell-flake doesn't set the default package, but you can do it here. - }; }; } diff --git a/index.html b/index.html deleted file mode 100644 index 574743e..0000000 --- a/index.html +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: Hi! ---- - -

Hi! I'm Jamie!

- -

- I also go by skiletro, or just simply skil, and use they/them pronouns. I'm - interested in a whole range of things; most of which have some sort of - connection to technology. Mechanical keyboards, and linux ricing are some of - my current interests, alongside esports, hardware, and a little language - learning on the side! -

- -

Projects

- - -

Programming Languages and Other Skills

- - -

Contact Me

-

- Feel free to contact me on - matrix, or through social - media. I don't bite! -

- -
- -

Posts

-$partial("templates/post-list.html")$ - -

…or you can find more in the archives.

diff --git a/pages/playlists.html b/pages/playlists.html deleted file mode 100644 index 8437667..0000000 --- a/pages/playlists.html +++ /dev/null @@ -1,57 +0,0 @@ -

Playlists

- -

Consider Yourself Drunk

- - - A chill DnB-ish Playlist - - -

Lofi Refined

- - - A smaller set of lofi songs, more carefully picked - - -

Chilled Out

- - - Mix of chiller DnB and stuff like that - - -

Pills

- - - DnB, Jump-up, all that good stuff - - -

More Playlists

-

- More playlists can be found on my - Spotify profile! I try - and add new songs to my playlists as much as I can, and I'm always creating - new playlists too! -

diff --git a/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md b/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md deleted file mode 100644 index 88fd45c..0000000 --- a/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: VR + NixOS + Nvidia ---- - -## ⚠️ Note - -This post is quite outdated now. -The 'prerequisites' section is still quite accurate, as you still need the proprietary drivers, however setting WiVRn -up is significantly easier. I recommend looking at the [Linux VR Adventures Wiki](https://lvra.gitlab.io/docs/distros/nixos/) -for a much better guide. - -## Introduction - -For the longest time, getting VR working nicely with Linux (and especially NixOS) was a monumental task. -Nowadays however, it is easier than ever: only requiring a handful of lines of Nix! - -## Prerequisites - -In this blog post, I will be focusing on getting VR working with Steam games, using an Oculus Quest 2 headset. -Ensure you have the proprietary Nvidia drivers installed, as this will most likely not work without them. -You will also need Home Manager setup, as we will be utilising that to get Steam games working. - -```nix -# Generic drivers, good to have -hardware.graphics = { - enable = true; - enable32Bit = true; -}; - -# Nvidia specific -hardware.nvidia = { - modesetting.enable = true; - open = true; -}; - -services.xserver.videoDrivers = ["nvidia"]; -``` - -## Installing WiVRn - -As I am using a Quest 2, I am going to use an application called WiVRn, which will allow me to stream both wired _or_ wirelessly. -If you are using a tethered headset such as a HTC Vive or Valve Index, I can recommend you look into [Monado](https://gitlab.freedesktop.org/monado/monado). -WiVRn is actually based on Monado, so gertting it up and running should be fairly similar. -All we need to get WiVRn installed is put the following in our configuration! - -```nix -/* configuration.nix */ -services.wivrn = { - enable = true; - openFirewall = true; # Required for wireless streaming - defaultRuntime = true; -}; -``` - -Although we don't _necessarily_ need anything else now, installing some quality-of-life tools will definitely benefit us. - -```nix -/* configuration.nix */ -environment.systemPackages = with pkgs; [ - wlx-overlay-s # In-VR overlay - android-tools # Allows for wired WiVRn -]; -``` - -## Getting Steam games working - -If all we want to do is play OpenXR games, we're set! -Most, if not all, steam games use OpenVR though, so we will need a compatibility layer: OpenComposite. -We can tell Steam to use OpenComposite and WiVRn for games by writing a few configuration files. -Because these files live in our home directory, we need to use Home Manager. -In home.nix, or wherever you have your home configuration: - -```nix -/* home.nix */ -xdg.configFile."openxr/1/active_runtime.json".source = - "${osConfig.services.wivrn.package}/share/openxr/1/openxr_wivrn.json"; - -xdg.configFile."openvr/openvrpaths.vrpath".text = '' - { - "config" : - [ - "${config.xdg.dataHome}/Steam/config" - ], - "external_drivers" : null, - "jsonid" : "vrpathreg", - "log" : - [ - "${config.xdg.dataHome}/Steam/logs" - ], - "runtime" : - [ - "${pkgs.opencomposite}/lib/opencomposite" - ], - "version" : 1 - } -''; -``` - -We are using `osConfig` in this case, as to use the same package we use when enabling WiVRn, meaning that if we changed `services.wivrn.package` in the future, it will use that package instead of the generic one from nixpkgs. - -Going back to our main configuration, we now need to tell the game to actually use these settings. - -We can do this by setting our game launch options to... -```sh -PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/wivrn/comp_ipc %command% -``` -...however, that isn't very "Nix", is it? -To do this for _every_ game, we can override our steam package to include this environment variable. - -```nix -/* configuration.nix */ -programs.steam.package = lib.mkDefault ( - pkgs.steam.override (prev: { - extraEnv = - { - PRESSURE_VESSEL_FILESYSTEMS_RW = "$XDG_RUNTIME_DIR/wivrn/comp_ipc"; - } - // (prev.extraEnv or {}); - }) -); -``` - -Don't worry about your flatscreen games: they should just ignore this setting! - -## Done! - -We should now just be able to open the "WiVRn server" GUI application, and start gaming! -You can read the [official WiVRn documentation](https://github.com/WiVRn/WiVRn?tab=readme-ov-file#running-1) for platform independent help on getting it up and running now, as the Nix specific stuff has now been sorted. diff --git a/site.hs b/site.hs deleted file mode 100644 index 7c9980b..0000000 --- a/site.hs +++ /dev/null @@ -1,155 +0,0 @@ --------------------------------------------------------------------------------- -{-# LANGUAGE OverloadedStrings #-} - -import Control.Exception -import Data.List -import Data.Monoid -import Hakyll -import Hakyll.Web.Sass -import System.Environment -import System.FilePath.Posix -import System.Process - --------------------------------------------------------------------------------- -main :: IO () -main = hakyll $ do - match "templates/*" $ compile templateBodyCompiler - - match ("assets/images/*" .||. "assets/fonts/*") $ do - route idRoute - compile copyFileCompiler - - match "assets/css/*" $ do - route $ setExtension "css" - let compressCssItem = fmap compressCss - compile (compressCssItem <$> sassCompiler) - - match "posts/*" $ do - route prettyRoute - compile $ - pandocCompiler - >>= loadAndApplyTemplate "templates/post.html" postCtx - >>= saveSnapshot "content" - >>= loadAndApplyTemplate "templates/default.html" postCtx - >>= relativizeUrls - >>= removeIndexHtml - - match "pages/*.html" $ do - route prettyRoute - compile $ - pandocCompiler - >>= loadAndApplyTemplate "templates/default.html" defaultCtx - >>= relativizeUrls - >>= removeIndexHtml - - match "404.html" $ do - route idRoute - compile $ - pandocCompiler - >>= loadAndApplyTemplate "templates/default.html" defaultCtx - >>= relativizeUrls - >>= removeIndexHtml - - create ["archive.html"] $ do - route prettyRoute - compile $ do - posts <- recentFirst =<< loadAll "posts/*" - let archiveCtx = - listField "posts" postCtx (return posts) - <> constField "title" "Archives" - <> defaultCtx - - makeItem "" - >>= loadAndApplyTemplate "templates/archive.html" archiveCtx - >>= loadAndApplyTemplate "templates/default.html" archiveCtx - >>= relativizeUrls - >>= removeIndexHtml - - match "index.html" $ do - route idRoute - compile $ do - posts <- recentFirst =<< loadAll "posts/*" - let indexCtx = - listField "posts" postCtx (return posts) - <> defaultCtx - - getResourceBody - >>= applyAsTemplate indexCtx - >>= loadAndApplyTemplate "templates/default.html" indexCtx - >>= relativizeUrls - >>= removeIndexHtml - - create ["atom.xml"] $ do - route idRoute - compile $ do - let feedCtx = postCtx <> bodyField "description" - posts <- - fmap (take 10) . recentFirst - =<< loadAllSnapshots "posts/*" "content" - renderAtom feedConfiguration feedCtx posts - - create ["rss.xml"] $ do - route idRoute - compile $ do - let feedCtx = postCtx <> bodyField "description" - posts <- - fmap (take 10) . recentFirst - =<< loadAllSnapshots "posts/*" "content" - renderRss feedConfiguration feedCtx posts - --------------------------------------------------------------------------------- -feedConfiguration :: FeedConfiguration -feedConfiguration = - FeedConfiguration - { feedTitle = "Posts on Skiletro.com", - feedDescription = "Recent posts from Skiletro.com", - feedAuthorName = "Skiletro", - feedAuthorEmail = "19377854+skiletro@users.noreply.github.com", -- you're not getting my email that easily - feedRoot = "https://skiletro.com" - } - --------------------------------------------------------------------------------- - -prettyRoute :: Routes -prettyRoute = customRoute createIndexRoute - where - createIndexRoute ident = - takeDirectory p takeBaseName p "index.html" - where - p = toFilePath ident - -removeIndexHtml :: Item String -> Compiler (Item String) -removeIndexHtml item = return $ fmap (withUrls removeIndexStr) item - where - removeIndexStr :: String -> String - removeIndexStr url = case splitFileName url of - (dir, "index.html") | isLocal dir -> dir - _ -> url - where - isLocal uri = not ("://" `isInfixOf` uri) - --------------------------------------------------------------------------------- - -defaultCtx :: Context String -defaultCtx = gitRevisionCtx <> defaultContext - -postCtx :: Context String -postCtx = hDateCtx <> cDateCtx <> defaultCtx - -hDateCtx :: Context String -hDateCtx = dateField "hdate" "%B %e, %Y" - -cDateCtx :: Context String -cDateCtx = dateField "cdate" "%Y-%m-%d" - -gitRevisionField :: String -> Context String -gitRevisionField = flip field (const gitRevision) - -gitRevision :: Compiler String -gitRevision = unixFilter "git" ["rev-parse", "--short=7", "HEAD"] "" - -gitRevisionCtx :: Context String -gitRevisionCtx = gitRevisionField "revision" - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/skiletro.cabal b/skiletro.cabal deleted file mode 100644 index e4c59af..0000000 --- a/skiletro.cabal +++ /dev/null @@ -1,15 +0,0 @@ -name: skiletro -version: 0.1.0.0 -build-type: Simple -cabal-version: >= 1.10 - -executable site - main-is: site.hs - build-depends: base == 4.* - , filepath - , hakyll == 4.16.* - , hakyll-sass == 0.2.* - , template-haskell == 2.21.* - , process == 1.6.25.* - ghc-options: -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 diff --git a/src/404.html b/src/404.html new file mode 100644 index 0000000..4bbf02f --- /dev/null +++ b/src/404.html @@ -0,0 +1,9 @@ +--- +title: 404 Not Found +--- + +

The page you requested cannot be found.

+ +

+ Click here to return back to the home page. +

diff --git a/src/assets/css/default.scss b/src/assets/css/default.scss new file mode 100644 index 0000000..8509dfb --- /dev/null +++ b/src/assets/css/default.scss @@ -0,0 +1,276 @@ +// VARIABLES AND IMPORTS +// --------------------------------------------------------------------------- + +$clr-bg: oklch(22.49% 0.008 297.21); +$clr-fg: oklch(98.51% 0 0); +$clr-primary: oklch(82.67% 0.096 307.5); +$clr-secondary: oklch(from $clr-primary l c 240); // hue-shifted copy + +$gap: 1rem; +$max-width: 50rem; +$mobile: 980px; + +@import "syntax"; + +// MIXINS +// --------------------------------------------------------------------------- + +@mixin phone-only { + @media (max-width: $mobile) { + @content; + } +} + +@mixin std-block { + display: block; + margin: 0; +} + +// GLOBAL RESET & TYPOGRAPHY +// --------------------------------------------------------------------------- + +*, +*::before, +*::after { + box-sizing: border-box; +} + +* { + padding: 0; + margin: 0; + transition: 0.1s ease-in-out; + font-family: "Atkinson Hyperlegible Next", sans-serif; + font-optical-sizing: auto; + text-transform: lowercase; +} + +html { + font-size: 16px; +} + +// 1rem base + +body { + display: flex; + flex-direction: column; + align-items: center; + gap: $gap; + padding: 5rem $gap $gap; + overflow-x: hidden; + color: $clr-fg; + background-color: black; + background: + url("/assets/images/noise.png"), + radial-gradient(circle at center, $clr-bg, transparent), + radial-gradient(circle at bottom left, #27577d, transparent), + radial-gradient(circle at top right, #952ea4 0%, transparent), + radial-gradient(circle at center right, #6949a5 0%, transparent), + radial-gradient(circle at top center, #336ba0 0%, transparent); + background-attachment: fixed; +} + +// LAYOUT WRAPPER +// --------------------------------------------------------------------------- + +body > * { + // every top-level section + display: flex; + flex-direction: column; + gap: $gap; + width: 100%; + max-width: $max-width; + padding: 1.5rem 2.5rem; + background: $clr-bg; + outline: 0.2rem solid $clr-bg; + outline-offset: 0.2rem; +} + +@include phone-only { + body { + padding: 0; + gap: 0.2rem; + } + + body > * { + outline: 0; + } +} + +// NAVIGATION +// --------------------------------------------------------------------------- + +nav { + position: fixed; + transform: translateX(28rem); + display: flex; + flex-direction: column; + align-items: center; + gap: $gap; + padding: 1rem 2rem; + width: 0rem; + + svg { + width: 2rem; + height: 2rem; + fill: $clr-fg; + } + + a { + writing-mode: vertical-rl; + text-orientation: sideways; + text-decoration: none; + color: $clr-fg; + } + + hr { + width: 100%; + } +} + +@include phone-only { + nav { + position: static; + transform: none; + flex-direction: row; + justify-content: space-between; + width: 100%; + + a { + writing-mode: horizontal-tb; + } + + hr { + display: none; + } + } +} + +// TYPOGRAPHIC ELEMENTS +// --------------------------------------------------------------------------- + +p, +ul, +span { + font-size: 1.2rem; + text-align: justify; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + @include std-block; + padding-top: 0.5rem; + font-size: 1.75rem; +} + +// auto-generate heading prefixes +@for $i from 1 through 6 { + h#{$i}::before { + $hashes: ""; + + @for $_ from 1 through $i { + $hashes: $hashes + "#"; + } + + content: "#{$hashes} "; + color: oklch(82.67% 0.087 #{280 + ($i - 1) * 40}); + } +} + +// LISTS +// --------------------------------------------------------------------------- + +ul { + display: flex; + flex-direction: column; + gap: 0.5rem; + list-style: none; + + li::before { + content: "~"; + padding: 0 0.25rem 0 0.5rem; + color: oklch(82.67% 0.087 180); + } +} + +// rainbow list items +@for $i from 1 through 15 { + ul li:nth-child(n + #{$i})::before { + color: oklch(82.67% 0.087 #{100 + ($i - 1) * 80}); + } +} + +// LINKS & MISC +// --------------------------------------------------------------------------- + +a { + color: $clr-primary; + + &:hover { + filter: brightness(0.75); + } +} + +hr { + $c: oklch(from $clr-fg 0.45 c h); + background: $c; + border-color: $c; +} + +img { + user-select: none; +} + +address { + opacity: 0.5; + text-align: right; + margin-top: -2.1lh; + margin-bottom: 0.5rem; +} + +footer { + gap: 0; + + > * { + text-align: center; + font-size: 1rem; + opacity: 0.5; + } +} + +// CODE BLOCKS +// --------------------------------------------------------------------------- + +div.sourceCode { + padding: 0.2rem; + overflow: hidden; + font-family: "Atkinson Hyperlegible Mono", monospace; + background-color: black; + background: + url("/images/noise.png"), + radial-gradient(circle at center, $clr-bg, transparent), + radial-gradient(circle at bottom left, #27577d, transparent), + radial-gradient(circle at top right, #952ea4 0%, transparent), + radial-gradient(circle at center right, #6949a5 0%, transparent), + radial-gradient(circle at top center, #336ba0 0%, transparent); + background-attachment: scroll; + + outline: 0.2rem solid $clr-bg; + outline-offset: 0.2rem; + + > * { + background: $clr-bg; + background-attachment: fixed; + padding: 1.2rem; + overflow: auto; + } + + * { + font-family: "Atkinson Hyperlegible Mono", monospace; + text-transform: none; + font-size: 1.05rem; + } +} diff --git a/src/assets/css/syntax.scss b/src/assets/css/syntax.scss new file mode 100644 index 0000000..42be310 --- /dev/null +++ b/src/assets/css/syntax.scss @@ -0,0 +1,243 @@ +a.sourceLine { + display: inline-block; + line-height: 1.25; +} + +a.sourceLine { + pointer-events: none; + color: inherit; + text-decoration: inherit; +} + +a.sourceLine:empty { + height: 1.2em; +} + +.sourceCode { + overflow: visible; +} + +code.sourceCode { + white-space: pre; + position: relative; +} + +div.sourceCode { + margin: 1em 0; +} + +pre.sourceCode { + margin: 0; +} + +@media screen { + div.sourceCode { + overflow: auto; + } +} + +@media print { + code.sourceCode { + white-space: pre-wrap; + } + + a.sourceLine { + text-indent: -1em; + padding-left: 1em; + } +} + +pre.numberSource a.sourceLine { + position: relative; + left: -4em; +} + +pre.numberSource a.sourceLine::before { + content: attr(title); + position: relative; + left: -1em; + text-align: right; + vertical-align: baseline; + border: none; + pointer-events: all; + display: inline-block; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + padding: 0 4px; + width: 4em; + color: #aaaaaa; +} + +pre.numberSource { + margin-left: 3em; + border-left: 1px solid #aaaaaa; + padding-left: 4px; +} + +div.sourceCode { +} + +@media screen { + a.sourceLine::before { + text-decoration: underline; + } +} + +code span.al { + color: #f85858; + font-weight: bold; +} + +/* Alert */ +code span.an { + color: #3dddd8; + font-weight: bold; + font-style: italic; +} + +/* Annotation */ +code span.at { + color: #2ac68e; +} + +/* Attribute */ +code span.bn { + color: #2ac68e; +} + +/* BaseN */ +code span.bu { +} + +/* BuiltIn */ +code span.cf { + color: #2ac68e; + font-weight: bold; +} + +/* ControlFlow */ +code span.ch { + color: #008ce3; +} + +/* Char */ +code span.cn { + color: #f85858; +} + +/* Constant */ +code span.co { + color: #3dddd8; + font-style: italic; +} + +/* Comment */ +code span.cv { + color: #3dddd8; + font-weight: bold; + font-style: italic; +} + +/* CommentVar */ +code span.do { + color: #f85858; + font-style: italic; +} + +/* Documentation */ +code span.dt { + color: #f85858; +} + +/* DataType */ +code span.dv { + color: #2ac68e; +} + +/* DecVal */ +code span.er { + color: #f85858; + font-weight: bold; +} + +/* Error */ +code span.ex { +} + +/* Extension */ +code span.fl { + color: #40a070; +} + +/* Float */ +code span.fu { + color: #008ce3; +} + +/* Function */ +code span.im { +} + +/* Import */ +code span.in { + color: #3dddd8; + font-weight: bold; + font-style: italic; +} + +/* Information */ +code span.kw { + color: #2ac68e; + font-weight: bold; +} + +/* Keyword */ +code span.op { + color: #aaaaaa; +} + +/* Operator */ +code span.ot { + color: #2ac68e; +} + +/* Other */ +code span.pp { + color: #ff8a00; +} + +/* Preprocessor */ +code span.sc { + color: #4070a0; +} + +/* SpecialChar */ +code span.ss { + color: #008ce3; +} + +/* SpecialString */ +code span.st { + color: #008ce3; +} + +/* String */ +code span.va { + color: #008ce3; +} + +/* Variable */ +code span.vs { + color: #008ce3; +} + +/* VerbatimString */ +code span.wa { + color: #3dddd8; + font-weight: bold; + font-style: italic; +} diff --git a/src/assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf b/src/assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf new file mode 100644 index 0000000..157d62e Binary files /dev/null and b/src/assets/fonts/AtkinsonHyperlegibleMono-Regular.ttf differ diff --git a/src/assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf b/src/assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf new file mode 100644 index 0000000..3fa771f Binary files /dev/null and b/src/assets/fonts/AtkinsonHyperlegibleNext-Regular.ttf differ diff --git a/src/assets/images/converter.webp b/src/assets/images/converter.webp new file mode 100644 index 0000000..36764fa Binary files /dev/null and b/src/assets/images/converter.webp differ diff --git a/src/assets/images/erebus.webp b/src/assets/images/erebus.webp new file mode 100644 index 0000000..510545e Binary files /dev/null and b/src/assets/images/erebus.webp differ diff --git a/src/assets/images/favicon.ico b/src/assets/images/favicon.ico new file mode 100644 index 0000000..5000bb7 Binary files /dev/null and b/src/assets/images/favicon.ico differ diff --git a/src/assets/images/noise.png b/src/assets/images/noise.png new file mode 100644 index 0000000..93c1ad7 Binary files /dev/null and b/src/assets/images/noise.png differ diff --git a/src/assets/images/nonbinary-flag.svg b/src/assets/images/nonbinary-flag.svg new file mode 100644 index 0000000..5252870 --- /dev/null +++ b/src/assets/images/nonbinary-flag.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..574743e --- /dev/null +++ b/src/index.html @@ -0,0 +1,97 @@ +--- +title: Hi! +--- + +

Hi! I'm Jamie!

+ +

+ I also go by skiletro, or just simply skil, and use they/them pronouns. I'm + interested in a whole range of things; most of which have some sort of + connection to technology. Mechanical keyboards, and linux ricing are some of + my current interests, alongside esports, hardware, and a little language + learning on the side! +

+ +

Projects

+ + +

Programming Languages and Other Skills

+ + +

Contact Me

+

+ Feel free to contact me on + matrix, or through social + media. I don't bite! +

+ +
+ +

Posts

+$partial("templates/post-list.html")$ + +

…or you can find more in the archives.

diff --git a/src/pages/playlists.html b/src/pages/playlists.html new file mode 100644 index 0000000..8437667 --- /dev/null +++ b/src/pages/playlists.html @@ -0,0 +1,57 @@ +

Playlists

+ +

Consider Yourself Drunk

+ + + A chill DnB-ish Playlist + + +

Lofi Refined

+ + + A smaller set of lofi songs, more carefully picked + + +

Chilled Out

+ + + Mix of chiller DnB and stuff like that + + +

Pills

+ + + DnB, Jump-up, all that good stuff + + +

More Playlists

+

+ More playlists can be found on my + Spotify profile! I try + and add new songs to my playlists as much as I can, and I'm always creating + new playlists too! +

diff --git a/src/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md b/src/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md new file mode 100644 index 0000000..7270865 --- /dev/null +++ b/src/posts/2025-06-20-vr-plus-nixos-plus-nvidia.md @@ -0,0 +1,130 @@ +--- +title: VR + NixOS + Nvidia +--- + +## ⚠️ Note + +This post is quite outdated now. +The 'prerequisites' section is still quite accurate, as you still need the proprietary drivers, however setting WiVRn +up is significantly easier. I recommend looking at the [Linux VR Adventures Wiki](https://lvra.gitlab.io/docs/distros/nixos/) +for a much better guide. + +## Introduction + +For the longest time, getting VR working nicely with Linux (and especially NixOS) was a monumental task. +Nowadays however, it is easier than ever: only requiring a handful of lines of Nix! + +## Prerequisites + +In this blog post, I will be focusing on getting VR working with Steam games, using an Oculus Quest 2 headset. +Ensure you have the proprietary Nvidia drivers installed, as this will most likely not work without them. +You will also need Home Manager setup, as we will be utilising that to get Steam games working. + +```nix +# Generic drivers, good to have +hardware.graphics = { + enable = true; + enable32Bit = true; +}; + +# Nvidia specific +hardware.nvidia = { + modesetting.enable = true; + open = true; +}; + +services.xserver.videoDrivers = ["nvidia"]; +``` + +## Installing WiVRn + +As I am using a Quest 2, I am going to use an application called WiVRn, which will allow me to stream both wired _or_ wirelessly. +If you are using a tethered headset such as a HTC Vive or Valve Index, I can recommend you look into [Monado](https://gitlab.freedesktop.org/monado/monado). +WiVRn is actually based on Monado, so gertting it up and running should be fairly similar. +All we need to get WiVRn installed is put the following in our configuration! + +```nix +/* configuration.nix */ +services.wivrn = { + enable = true; + openFirewall = true; # Required for wireless streaming + defaultRuntime = true; +}; +``` + +Although we don't _necessarily_ need anything else now, installing some quality-of-life tools will definitely benefit us. + +```nix +/* configuration.nix */ +environment.systemPackages = with pkgs; [ + wlx-overlay-s # In-VR overlay + android-tools # Allows for wired WiVRn +]; +``` + +## Getting Steam games working + +If all we want to do is play OpenXR games, we're set! +Most, if not all, steam games use OpenVR though, so we will need a compatibility layer: OpenComposite. +We can tell Steam to use OpenComposite and WiVRn for games by writing a few configuration files. +Because these files live in our home directory, we need to use Home Manager. +In home.nix, or wherever you have your home configuration: + +```nix +/* home.nix */ +xdg.configFile."openxr/1/active_runtime.json".source = + "${osConfig.services.wivrn.package}/share/openxr/1/openxr_wivrn.json"; + +xdg.configFile."openvr/openvrpaths.vrpath".text = '' + { + "config" : + [ + "${config.xdg.dataHome}/Steam/config" + ], + "external_drivers" : null, + "jsonid" : "vrpathreg", + "log" : + [ + "${config.xdg.dataHome}/Steam/logs" + ], + "runtime" : + [ + "${pkgs.opencomposite}/lib/opencomposite" + ], + "version" : 1 + } +''; +``` + +We are using `osConfig` in this case, as to use the same package we use when enabling WiVRn, meaning that if we changed `services.wivrn.package` in the future, it will use that package instead of the generic one from nixpkgs. + +Going back to our main configuration, we now need to tell the game to actually use these settings. + +We can do this by setting our game launch options to... + +```sh +PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/wivrn/comp_ipc %command% +``` + +...however, that isn't very "Nix", is it? +To do this for _every_ game, we can override our steam package to include this environment variable. + +```nix +/* configuration.nix */ +programs.steam.package = lib.mkDefault ( + pkgs.steam.override (prev: { + extraEnv = + { + PRESSURE_VESSEL_FILESYSTEMS_RW = "$XDG_RUNTIME_DIR/wivrn/comp_ipc"; + } + // (prev.extraEnv or {}); + }) +); +``` + +Don't worry about your flatscreen games: they should just ignore this setting! + +## Done! + +We should now just be able to open the "WiVRn server" GUI application, and start gaming! +You can read the [official WiVRn documentation](https://github.com/WiVRn/WiVRn?tab=readme-ov-file#running-1) for platform independent help on getting it up and running now, as the Nix specific stuff has now been sorted. diff --git a/src/templates/archive.html b/src/templates/archive.html new file mode 100644 index 0000000..346e978 --- /dev/null +++ b/src/templates/archive.html @@ -0,0 +1,3 @@ +Here you can find all my previous posts: + +$partial("templates/post-list.html")$ diff --git a/src/templates/default.html b/src/templates/default.html new file mode 100644 index 0000000..58df794 --- /dev/null +++ b/src/templates/default.html @@ -0,0 +1,97 @@ + + + + + $title$ ~ Skiletro + + + + + + + + + + + + + + + + +
$body$
+ + + diff --git a/src/templates/post-list.html b/src/templates/post-list.html new file mode 100644 index 0000000..a614f13 --- /dev/null +++ b/src/templates/post-list.html @@ -0,0 +1,5 @@ + diff --git a/src/templates/post.html b/src/templates/post.html new file mode 100644 index 0000000..27f17da --- /dev/null +++ b/src/templates/post.html @@ -0,0 +1,7 @@ +

$title$

+
+ Posted on + +
+ +$body$ diff --git a/ssg/Main.hs b/ssg/Main.hs new file mode 100644 index 0000000..c130c91 --- /dev/null +++ b/ssg/Main.hs @@ -0,0 +1,151 @@ +-------------------------------------------------------------------------------- +{-# LANGUAGE OverloadedStrings #-} + +import Control.Exception +import Data.List +import Data.Maybe +import Data.Monoid +import Hakyll +import Hakyll.Web.Sass +import System.Environment +import System.FilePath.Posix +import System.Process + +-------------------------------------------------------------------------------- +main :: IO () +main = hakyll $ do + match "templates/*" $ compile templateBodyCompiler + + match ("assets/images/*" .||. "assets/fonts/*") $ do + route idRoute + compile copyFileCompiler + + match "assets/css/*" $ do + route $ setExtension "css" + let compressCssItem = fmap compressCss + compile (compressCssItem <$> sassCompiler) + + match "posts/*" $ do + route prettyRoute + compile $ + pandocCompiler + >>= loadAndApplyTemplate "templates/post.html" postCtx + >>= saveSnapshot "content" + >>= loadAndApplyTemplate "templates/default.html" postCtx + >>= relativizeUrls + >>= removeIndexHtml + + match "pages/*.html" $ do + route prettyRoute + compile $ + pandocCompiler + >>= loadAndApplyTemplate "templates/default.html" defaultCtx + >>= relativizeUrls + >>= removeIndexHtml + + match "404.html" $ do + route idRoute + compile $ + pandocCompiler + >>= loadAndApplyTemplate "templates/default.html" defaultCtx + -- >>= relativizeUrls + >>= removeIndexHtml + + create ["archive.html"] $ do + route prettyRoute + compile $ do + posts <- recentFirst =<< loadAll "posts/*" + let archiveCtx = + listField "posts" postCtx (return posts) + <> constField "title" "Archives" + <> defaultCtx + + makeItem "" + >>= loadAndApplyTemplate "templates/archive.html" archiveCtx + >>= loadAndApplyTemplate "templates/default.html" archiveCtx + >>= relativizeUrls + >>= removeIndexHtml + + match "index.html" $ do + route idRoute + compile $ do + posts <- recentFirst =<< loadAll "posts/*" + let indexCtx = + listField "posts" postCtx (return posts) + <> defaultCtx + + getResourceBody + >>= applyAsTemplate indexCtx + >>= loadAndApplyTemplate "templates/default.html" indexCtx + >>= relativizeUrls + >>= removeIndexHtml + + create ["atom.xml"] $ do + route idRoute + compile $ do + let feedCtx = postCtx <> bodyField "description" + posts <- + fmap (take 10) . recentFirst + =<< loadAllSnapshots "posts/*" "content" + renderAtom feedConfiguration feedCtx posts + + create ["rss.xml"] $ do + route idRoute + compile $ do + let feedCtx = postCtx <> bodyField "description" + posts <- + fmap (take 10) . recentFirst + =<< loadAllSnapshots "posts/*" "content" + renderRss feedConfiguration feedCtx posts + +-------------------------------------------------------------------------------- +feedConfiguration :: FeedConfiguration +feedConfiguration = + FeedConfiguration + { feedTitle = "Posts on Skiletro.com", + feedDescription = "Recent posts from Skiletro.com", + feedAuthorName = "Skiletro", + feedAuthorEmail = "19377854+skiletro@users.noreply.github.com", -- you're not getting my email that easily + feedRoot = "https://skiletro.com" + } + +-------------------------------------------------------------------------------- + +prettyRoute :: Routes +prettyRoute = customRoute createIndexRoute + where + createIndexRoute ident = + takeDirectory p takeBaseName p "index.html" + where + p = toFilePath ident + +removeIndexHtml :: Item String -> Compiler (Item String) +removeIndexHtml item = return $ fmap (withUrls removeIndexStr) item + where + removeIndexStr :: String -> String + removeIndexStr url = case splitFileName url of + (dir, "index.html") | isLocal dir -> dir + _ -> url + where + isLocal uri = not ("://" `isInfixOf` uri) + +-------------------------------------------------------------------------------- + +defaultCtx :: Context String +defaultCtx = gitRevisionCtx <> defaultContext + +postCtx :: Context String +postCtx = hDateCtx <> cDateCtx <> defaultCtx + +hDateCtx :: Context String +hDateCtx = dateField "hdate" "%B %e, %Y" + +cDateCtx :: Context String +cDateCtx = dateField "cdate" "%Y-%m-%d" + +gitRevisionCtx :: Context String +gitRevisionCtx = field "revision" $ \_ -> do + mRevision <- unsafeCompiler $ lookupEnv "GIT_REVISION" + return $ fromMaybe "dev" mRevision + +-------------------------------------------------------------------------------- diff --git a/ssg/ssg.cabal b/ssg/ssg.cabal new file mode 100644 index 0000000..c22ef58 --- /dev/null +++ b/ssg/ssg.cabal @@ -0,0 +1,15 @@ +name: ssg +version: 0.1.0.0 +build-type: Simple +cabal-version: >= 1.10 + +executable site + main-is: Main.hs + build-depends: base == 4.* + , filepath + , hakyll == 4.16.* + , hakyll-sass == 0.2.* + , template-haskell == 2.21.* + , process == 1.6.25.* + ghc-options: -threaded -rtsopts -with-rtsopts=-N + default-language: Haskell2010 diff --git a/templates/archive.html b/templates/archive.html deleted file mode 100644 index 346e978..0000000 --- a/templates/archive.html +++ /dev/null @@ -1,3 +0,0 @@ -Here you can find all my previous posts: - -$partial("templates/post-list.html")$ diff --git a/templates/default.html b/templates/default.html deleted file mode 100644 index 1193592..0000000 --- a/templates/default.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - $title$ ~ Skiletro - - - - - - - - - - - - - - - - -
$body$
- - - diff --git a/templates/post-list.html b/templates/post-list.html deleted file mode 100644 index a614f13..0000000 --- a/templates/post-list.html +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/templates/post.html b/templates/post.html deleted file mode 100644 index 27f17da..0000000 --- a/templates/post.html +++ /dev/null @@ -1,7 +0,0 @@ -

$title$

-
- Posted on - -
- -$body$ -- cgit v1.3.1