diff options
| author | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-07-29 00:56:12 +0200 |
|---|---|---|
| committer | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-07-29 00:56:12 +0200 |
| commit | 29b670de0bcf65eeaae7e95eb4607ced912c4a27 (patch) | |
| tree | 1c8a81f088ab4a4d2da03feb4ce97db892e9f760 | |
| parent | 3c97a3d8e52e4d96058e0b52ae347bccdb0360f6 (diff) | |
Apply "no style, please!" theme
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | config.toml | 4 | ||||
| -rw-r--r-- | flake.lock | 72 | ||||
| -rw-r--r-- | flake.nix | 95 | ||||
| -rw-r--r-- | sass/style.scss | 91 | ||||
| -rw-r--r-- | templates/base.html | 26 | ||||
| -rw-r--r-- | templates/blog-page.html | 4 | ||||
| -rw-r--r-- | templates/index.html | 33 |
8 files changed, 131 insertions, 197 deletions
@@ -1,3 +1,6 @@ /.direnv /public + +# nix /result +/themes diff --git a/config.toml b/config.toml index 6ca5e3d..b880bde 100644 --- a/config.toml +++ b/config.toml @@ -7,6 +7,10 @@ compile_sass = true # Whether to build a search index to be used later on by a JavaScript library build_search_index = false +theme = "no style, please!" + +generate_feed = true + [markdown] # Whether to do syntax highlighting # Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola @@ -1,26 +1,5 @@ { "nodes": { - "devshell": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1721902368, - "narHash": "sha256-noQ5SghRPe0jzQEbFQb3fYbV6LZEzr7lIRQoxlU7fyI=", - "owner": "numtide", - "repo": "devshell", - "rev": "cf8c7405479cfde7ea4dc815e195391d2328df10", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -55,24 +34,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -138,6 +99,22 @@ "type": "github" } }, + "no-style-please": { + "flake": false, + "locked": { + "lastModified": 1710334085, + "narHash": "sha256-1rgNB7nJVkIdYLLh1h4GQ79Z+RC5LjczA8PzfiAqpVM=", + "owner": "atgumx", + "repo": "no-style-please", + "rev": "5481a5d239dbd60ec4ad10c9c692fb0a273173a0", + "type": "gitlab" + }, + "original": { + "owner": "atgumx", + "repo": "no-style-please", + "type": "gitlab" + } + }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": "flake-compat", @@ -163,28 +140,13 @@ }, "root": { "inputs": { - "devshell": "devshell", "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", + "no-style-please": "no-style-please", "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" - } - }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -4,10 +4,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; - devshell = { - url = "github:numtide/devshell"; - inputs.nixpkgs.follows = "nixpkgs"; - }; treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -16,49 +12,82 @@ url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + no-style-please = { + url = "gitlab:atgumx/no-style-please"; + flake = false; + }; }; - outputs = inputs@{ flake-parts, ... }: + 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"; + perSystem = + { config, pkgs, ... }: + let + themeName = ((builtins.fromTOML (builtins.readFile "${inputs.no-style-please}/theme.toml")).name); + in + { + packages = { + default = config.packages.website; + website = pkgs.stdenv.mkDerivation { + pname = "sorre-website"; + version = "2023-11-15"; + src = ./.; + nativeBuildInputs = [ pkgs.zola ]; + configurePhase = '' + mkdir -p "themes/${themeName}" + cp -r ${inputs.no-style-please}/* "themes/${themeName}" + ''; + buildPhase = "zola build"; + installPhase = "cp -r public $out"; + }; }; - }; - devshells.default = { - packages = builtins.attrValues config.treefmt.build.programs; - commands = with pkgs; [{ package = zola; }]; - }; + devShells.default = + let + stdenvMinimal = pkgs.stdenvNoCC.override { + cc = null; + preHook = ""; + allowedRequisites = null; + initialPath = pkgs.lib.filter ( + a: pkgs.lib.hasPrefix "coreutils" a.name + ) pkgs.stdenvNoCC.initialPath; + extraNativeBuildInputs = [ ]; + }; + minimalMkShell = pkgs.mkShell.override { stdenv = stdenvMinimal; }; + in + minimalMkShell { + packages = with pkgs; [ zola ] ++ builtins.attrValues config.treefmt.build.programs; + shellHook = '' + mkdir -p themes + ln -sn "${inputs.no-style-please}" "themes/${themeName}" + ''; + }; - treefmt = { - projectRootFile = ./flake.nix; - programs = { nixfmt.enable = true; }; - }; + 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; + 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 deleted file mode 100644 index e81f217..0000000 --- a/sass/style.scss +++ /dev/null @@ -1,91 +0,0 @@ -*, *::before, *::after { - box-sizing: border-box; -} - -body { - width: max-content; - max-width: 100%; - margin: 0; - padding: .25rem 1rem; -} - -header { - display: flex; - align-items: baseline; - gap: 0 1rem; - flex-wrap: wrap; - align-content: flex-start; - margin: 1rem 0; - - * { - margin: 0; - padding: 0; - } -} - -p { - max-width: 40em; - overflow-wrap: break-word; - hyphens: auto; - -webkit-hyphens: auto; /* for Safari */ -} - -code { - // Make sure we never wrap text in code blocks - hyphens: none; - overflow-wrap: normal; - word-break: keep-all; -} - -pre { - padding: 1rem; - font-size: 1rem; - overflow: auto; - - // The line numbers already provide some kind of left/right padding - [data-lineos] { - padding: 1rem 0; - } - - table { - width: 100%; - border-collapse: collapse; - - td { - padding: 0; - - // The line number cells - :nth-of-type(1) { - text-align: center; - user-select: none; - } - } - } - - 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); - } -} - -ul > li { - display: flex; - flex-wrap: wrap; - align-content: flex-start; - align-items: baseline; - gap: 0 1rem; -} - -nav { - p, ul, li { - margin: 0; - padding: 0; - } - - display: flex; - flex-direction: column; - align-content: flex-start; - gap: .25rem; -} diff --git a/templates/base.html b/templates/base.html index f07856d..53a9db5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,13 +2,31 @@ <html lang="en"> <head> - <meta charset="utf-8"> - <title>Sorre</title> + <meta charset="UTF-8"> + <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> + <meta content="width=device-width, initial-scale=1" name="viewport" /> <link rel="stylesheet" href="/style.css"> + + {% if page.title %} + {% set title = page.title %} + {% elif section.title %} + {% set title = section.title %} + {% elif config.title %} + {% set title = config.title %} + {% endif %} + {% if title %}<title>{{ title }}</title>{% endif %} + + {% if config.generate_feed %} + <link rel="alternate" type="application/atom+xml" title="RSS" href="{{ get_url(path="atom.xml", trailing_slash=false)}}"> + {% endif %} + + <link rel="stylesheet" href="{{ get_url(path='style.css', trailing_slash=false) | safe }}" /> </head> -<body> - {% block content %} {% endblock %} +<body theme="auto"> + <div class="w"> + {% block content %} {% endblock %} + </div> </body> </html> diff --git a/templates/blog-page.html b/templates/blog-page.html index 0414d85..2e54a27 100644 --- a/templates/blog-page.html +++ b/templates/blog-page.html @@ -3,7 +3,7 @@ {% block content %} <header> - <h1 class="title"> + <h1 id="title"> {{ page.title }} </h1> <div> @@ -14,4 +14,4 @@ </header> {{ page.content | safe }} -{% endblock content %} +{% endblock content %}
\ No newline at end of file diff --git a/templates/index.html b/templates/index.html index d894455..f57baf5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,23 +1,32 @@ {% extends "base.html" %} {% block content %} -<h1 class="title"> +<h1 id="page-title"> {{ section.title }} </h1> <p>{{ section.description }}</p> <nav> - Posts: - <ul> - {% for page in section.pages %} - <li> - <a href="{{ page.permalink | safe }}">{{ page.title }}</a> - <p>written: {{ page.date }}, </p> - <p>updated: {{ page.updated }}</p> - </li> - {% endfor %} - </ul> + <table> + <caption> + Posts + </caption> + <thead> + <tr> + <td>Title</td> + <td>Date</td> + </tr> + </thead> + <tbody> + {% for page in section.pages %} + <tr> + <td><a href="{{ page.permalink | safe }}">{{page.title}}</a></td> + <td>{{ page.date }}</td> + </tr> + {% endfor %} + </tbody> + </table> </nav> -{% endblock %} +{% endblock %}
\ No newline at end of file |
