From 29b670de0bcf65eeaae7e95eb4607ced912c4a27 Mon Sep 17 00:00:00 2001 From: Miran Bastaja Date: Mon, 29 Jul 2024 00:56:12 +0200 Subject: Apply "no style, please!" theme --- .gitignore | 3 ++ config.toml | 4 ++ flake.lock | 72 +++++++++--------------------------- flake.nix | 95 +++++++++++++++++++++++++++++++----------------- sass/style.scss | 91 ---------------------------------------------- templates/base.html | 26 +++++++++++-- templates/blog-page.html | 4 +- templates/index.html | 33 +++++++++++------ 8 files changed, 131 insertions(+), 197 deletions(-) delete mode 100644 sass/style.scss diff --git a/.gitignore b/.gitignore index f541c17..1141ca6 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/flake.lock b/flake.lock index d8dcac0..3237e77 100644 --- a/flake.lock +++ b/flake.lock @@ -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": [ diff --git a/flake.nix b/flake.nix index 0917648..2258c4c 100644 --- a/flake.nix +++ b/flake.nix @@ -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 @@ - - Sorre + + + + + {% 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 }}{% endif %} + + {% if config.generate_feed %} + + {% endif %} + + - - {% block content %} {% endblock %} + +
+ {% block content %} {% endblock %} +
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 %}
-

+

{{ page.title }}

@@ -14,4 +14,4 @@
{{ 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 %} -

+

{{ section.title }}

{{ section.description }}

-{% endblock %} +{% endblock %} \ No newline at end of file -- cgit v1.3.1