summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiran Bastaja <miran.bastaja04@gmail.com>2023-11-15 02:53:51 +0100
committerMiran Bastaja <miran.bastaja04@gmail.com>2023-11-15 13:57:29 +0100
commitff5fdcd170e6565f225c4d47caed14c2c8d73ca5 (patch)
treecec896a54ffa48927e6dc503bc9856f9bc772bd6
Initial commit
-rw-r--r--.envrc1
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore3
-rw-r--r--config.toml16
-rw-r--r--content/_index.md6
-rw-r--r--content/shell-snippets.md23
-rw-r--r--flake.lock232
-rw-r--r--flake.nix67
-rw-r--r--sass/style.scss37
-rw-r--r--templates/base.html14
-rw-r--r--templates/blog-page.html13
-rw-r--r--templates/index.html19
12 files changed, 432 insertions, 0 deletions
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..b262138
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+flake.lock linguist-generated=true -diff
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f541c17
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/.direnv
+/public
+/result
diff --git a/config.toml b/config.toml
new file mode 100644
index 0000000..f54c322
--- /dev/null
+++ b/config.toml
@@ -0,0 +1,16 @@
+# The URL the site will be built for
+base_url = "https://sorre.xyz"
+
+# 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 = false
+
+[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
diff --git a/content/_index.md b/content/_index.md
new file mode 100644
index 0000000..f4ae211
--- /dev/null
+++ b/content/_index.md
@@ -0,0 +1,6 @@
++++
+title = "Sorre"
+description = "Random thoughts written down so I can come back to them later"
+template = "index.html"
+page_template = "blog-page.html"
++++
diff --git a/content/shell-snippets.md b/content/shell-snippets.md
new file mode 100644
index 0000000..257cc0b
--- /dev/null
+++ b/content/shell-snippets.md
@@ -0,0 +1,23 @@
++++
+title = "Shell snippets"
++++
+## Scraping images from open tabs
+```zsh
+jaq --raw-output --from-file export.json '..["url"]? | strings' \
+ | rg --fixed-strings "wallhaven.cc/w" \
+ | gallery-dl --input-file -
+```
+I exported my current session to json with tab session manager. This command
+takes that json export (referred to as `export.json`), finds all the urls
+that contain `wallhaven.cc/w` (i.e. all urls that are wallhaven images) and
+passes them to gallery-dl. Gallery-dl then neatly downloads all of those images
+in their original quality.
+
+This workflow could be made better by creating a version of tab session manager
+that exports in a simpler (or more configurable format), and I could also turn
+this into a script that takes the wanted website formats as an argument.
+Invocation of the script might look something like:
+```zsh
+tabsession-dl --format "wallhaven.cc/w" --format "reddit.com/r" \
+ --input-file export.json
+```
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..24721d8
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,232 @@
+{
+ "nodes": {
+ "devshell": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1698410321,
+ "narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=",
+ "owner": "numtide",
+ "repo": "devshell",
+ "rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "devshell",
+ "type": "github"
+ }
+ },
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1673956053,
+ "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": "nixpkgs-lib"
+ },
+ "locked": {
+ "lastModified": 1698882062,
+ "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
+ "type": "github"
+ },
+ "original": {
+ "id": "flake-parts",
+ "type": "indirect"
+ }
+ },
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems_2"
+ },
+ "locked": {
+ "lastModified": 1685518550,
+ "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "gitignore": {
+ "inputs": {
+ "nixpkgs": [
+ "pre-commit-hooks-nix",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1660459072,
+ "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1699781429,
+ "narHash": "sha256-UYefjidASiLORAjIvVsUHG6WBtRhM67kTjEY4XfZOFs=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "e44462d6021bfe23dfb24b775cc7c390844f773d",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-lib": {
+ "locked": {
+ "dir": "lib",
+ "lastModified": 1698611440,
+ "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735",
+ "type": "github"
+ },
+ "original": {
+ "dir": "lib",
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-stable": {
+ "locked": {
+ "lastModified": 1685801374,
+ "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-23.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "pre-commit-hooks-nix": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "flake-utils": "flake-utils",
+ "gitignore": "gitignore",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "nixpkgs-stable": "nixpkgs-stable"
+ },
+ "locked": {
+ "lastModified": 1699271226,
+ "narHash": "sha256-8Jt1KW3xTjolD6c6OjJm9USx/jmL+VVmbooADCkdDfU=",
+ "owner": "cachix",
+ "repo": "pre-commit-hooks.nix",
+ "rev": "ea758da1a6dcde6dc36db348ed690d09b9864128",
+ "type": "github"
+ },
+ "original": {
+ "owner": "cachix",
+ "repo": "pre-commit-hooks.nix",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "devshell": "devshell",
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs",
+ "pre-commit-hooks-nix": "pre-commit-hooks-nix",
+ "treefmt-nix": "treefmt-nix"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "systems_2": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1699786194,
+ "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..5d9c8ec
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,67 @@
+{
+ description = "My website hosting random thoughts";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ devshell = {
+ url = "github:numtide/devshell";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ treefmt-nix = {
+ url = "github:numtide/treefmt-nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ pre-commit-hooks-nix = {
+ url = "github:cachix/pre-commit-hooks.nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs = inputs@{ flake-parts, ... }:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ imports = [
+ inputs.devshell.flakeModule
+ inputs.treefmt-nix.flakeModule
+ inputs.pre-commit-hooks-nix.flakeModule
+ ];
+ systems = [ "x86_64-linux" ];
+ perSystem = { config, pkgs, ... }: {
+ packages = {
+ default = config.packages.website;
+ website = pkgs.stdenv.mkDerivation {
+ pname = "sorre-website";
+ version = "2023-11-15";
+ src = ./.;
+ nativeBuildInputs = [ pkgs.zola ];
+ buildPhase = "zola build";
+ installPhase = "cp -r public $out";
+ };
+ };
+
+ devshells.default = {
+ packages = builtins.attrValues config.treefmt.build.programs;
+ commands = with pkgs; [
+ { package = zola; }
+ ];
+ };
+
+ treefmt = {
+ projectRootFile = ./flake.nix;
+ programs = {
+ nixfmt.enable = true;
+ };
+ };
+
+ pre-commit = {
+ check.enable = true;
+ settings = {
+ settings = { treefmt.package = config.treefmt.build.wrapper; };
+ hooks = {
+ treefmt.enable = true;
+ deadnix.enable = true;
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/sass/style.scss b/sass/style.scss
new file mode 100644
index 0000000..d4cc71c
--- /dev/null
+++ b/sass/style.scss
@@ -0,0 +1,37 @@
+body {
+ width: max-content;
+}
+
+pre {
+ padding: 1rem;
+ font-size: 1rem;
+ overflow: auto;
+}
+// The line numbers already provide some kind of left/right padding
+pre[data-linenos] {
+ padding: 1rem 0;
+}
+pre table td {
+ padding: 0;
+}
+// The line number cells
+pre table td:nth-of-type(1) {
+ text-align: center;
+ user-select: none;
+}
+pre mark {
+ // If you want your highlights to take the full width.
+ display: block;
+ // The default background colour of a mark is bright yellow
+ background-color: rgba(254, 252, 232, 0.9);
+}
+pre table {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+p {
+ max-width: 40em;
+ word-wrap: break-word;
+ text-align: justify;
+}
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..f07856d
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="utf-8">
+ <title>Sorre</title>
+ <link rel="stylesheet" href="/style.css">
+</head>
+
+<body>
+ {% block content %} {% endblock %}
+</body>
+
+</html>
diff --git a/templates/blog-page.html b/templates/blog-page.html
new file mode 100644
index 0000000..f6e7ac7
--- /dev/null
+++ b/templates/blog-page.html
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+
+{% block content %}
+
+<div style="display:flex; align-items:baseline; gap:1rem;">
+ <h1 class="title">
+ {{ page.title }}
+ </h1>
+ <a href="/">home</a>
+</div>
+
+{{ page.content | safe }}
+{% endblock content %}
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..8fb3c95
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+
+{% block content %}
+<h1 class="title">
+ {{ section.title }}
+</h1>
+
+<p>{{ section.description }}</p>
+
+<p>
+ Posts:
+ <ul>
+ {% for page in section.pages %}
+ <li><a href="{{ page.permalink | safe }}">{{ page.title }}</a></li>
+ {% endfor %}
+ </ul>
+</p>
+
+{% endblock %}