diff --git a/README.md b/README.md index 734f27d56..6b0f24ac1 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ It contains pages about my products, services, public speaking and training, as The styling is done using [Tailwind CSS]. +## BrowserSync + +I have [BrowserSync][] installed and use it to watch for changes to files and [automatically refresh my browser][0] instead of using Sculpin's built-in development server. + ## Hosting The website is hosted on a 1GB DigitalOcean droplet alongside other static websites. @@ -16,6 +20,8 @@ I'm using Apache as my web server so I can easily manage redirects using the `.h As it's a static website, no PHP or database are needed. +[0]: https://www.oliverdavies.uk/blog/sculpin-browsersync +[browsersync]: https://browsersync.io [sculpin]: https://sculpin.io [tailwind css]: https://tailwindcss.com [website]: https://www.oliverdavies.uk diff --git a/app/config/sculpin_kernel.yml b/app/config/sculpin_kernel.yml index 498517c11..13a1b1ee0 100644 --- a/app/config/sculpin_kernel.yml +++ b/app/config/sculpin_kernel.yml @@ -1,7 +1,5 @@ --- sculpin_content_types: - daily_emails: - permalink: /daily/:year/:month/:day/:basename/ pages: permalink: /:basename/ podcast_episodes: @@ -10,6 +8,8 @@ sculpin_content_types: permalink: /blog/:basename/ presentations: permalink: /presentations/:basename/ + zets: + permalink: /zet/:basename-:title/ services: App\Experience\TwigExtension\ExperienceTwigExtension: diff --git a/app/config/sculpin_site.yml b/app/config/sculpin_site.yml index 12a6d0a9d..a10f3ccab 100644 --- a/app/config/sculpin_site.yml +++ b/app/config/sculpin_site.yml @@ -35,7 +35,7 @@ drupalorg: username: opdavies features: - new_css: true + new_css: false github: url: https://github.com/%github.username% @@ -48,20 +48,16 @@ mastodon: menu_links: - title: Home url: / - - title: Press Info - url: /press - - title: Services - url: /pricing - title: Presentations url: /presentations + - title: Blog + url: /blog - title: Podcast url: /podcast attributes: title: The Beyond Blocks Podcast - - title: Daily list - url: /daily - attributes: - title: The Daily Drupaler Email List + - title: Books + url: /books - title: Sponsor me url: /sponsor - title: Contact @@ -74,6 +70,13 @@ meta: Oliver is an Acquia-certified Triple Drupal expert, core contributor, Developer, Consultant and multiple-time DrupalCon speaker. testimonials: + - text: | + Oliver devised a creative and original approach to Drupal theme switching based on Tailwind and provided us with the building blocks and basic theming. + + He gave several helpful mentoring sessions with our front end developer to support us to build this approach into our site. + name: Technical Director, European knowledge platform + image: ~ + tags: [front] - text: | This course is really great and I've recommended it to my coworkers here at Palantir.net. name: Daniel Davis-Boxleitner diff --git a/build b/build new file mode 100755 index 000000000..2163f52ee --- /dev/null +++ b/build @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -uexo pipefail + +vendor/bin/sculpin generate --watch --server "$@" diff --git a/flake-modules/dev-shell.nix b/flake-modules/dev-shell.nix new file mode 100644 index 000000000..19b1cb76e --- /dev/null +++ b/flake-modules/dev-shell.nix @@ -0,0 +1,29 @@ +{ inputs, ... }: + +{ + imports = [ inputs.devshell.flakeModule ]; + + perSystem = + { pkgs, self', ... }: + { + devshells.default = { + packages = with pkgs; [ + nodePackages.browser-sync + + (php83.buildEnv { + extraConfig = '' + error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED + ''; + }) + + php83Packages.composer + + self'.packages.drafts + self'.packages.new-draft + self'.packages.publish + + tailwindcss + ]; + }; + }; +} diff --git a/flake-modules/drafts.nix b/flake-modules/drafts.nix new file mode 100644 index 000000000..f1ac84955 --- /dev/null +++ b/flake-modules/drafts.nix @@ -0,0 +1,16 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.drafts = pkgs.writeShellApplication { + name = "drafts"; + + runtimeInputs = with pkgs; [ gnugrep ]; + + text = '' + echo "oob" + grep -r 'draft: true' "''${1:-source}" + ''; + }; + }; +} diff --git a/flake-modules/new-draft.nix b/flake-modules/new-draft.nix new file mode 100644 index 000000000..31ee75800 --- /dev/null +++ b/flake-modules/new-draft.nix @@ -0,0 +1,33 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.new-draft = pkgs.writeShellApplication { + name = "new-draft"; + + runtimeInputs = with pkgs; [ + coreutils + git + ]; + + text = '' + title="$1" + + exclude_words="for|at|and" + + filtered_title=$(echo "$title" | sed -E "s/\b($exclude_words)\b//g") + + slug=$(echo "$filtered_title" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9]/-/g' -e 's/-\+/-/g' -e 's/^-//g' -e 's/-$//g') + + file="source/_posts/$slug.md" + + echo -e "---\ntitle: $title\ndate: ~\ndraft: true\n---" > "$file" + + echo "File created: $file" + + git add "$file" + git commit -s -m "Add draft: $title" + ''; + }; + }; +} diff --git a/flake-modules/publish.nix b/flake-modules/publish.nix new file mode 100644 index 000000000..d15ee49aa --- /dev/null +++ b/flake-modules/publish.nix @@ -0,0 +1,21 @@ +{ + perSystem = + { pkgs, ... }: + { + packages.publish = pkgs.writeShellApplication { + name = "publish"; + + runtimeInputs = with pkgs; [ + rsync + php + ]; + + text = '' + vendor/bin/sculpin generate --env prod + + rsync -uvrP static/ output_prod "$@" + rsync -uvrP output_prod/ nixedo.oliverdavies.uk:/var/www/vhosts/website-sculpin "$@" + ''; + }; + }; +} diff --git a/flake-modules/systems.nix b/flake-modules/systems.nix new file mode 100644 index 000000000..ce708c68b --- /dev/null +++ b/flake-modules/systems.nix @@ -0,0 +1,3 @@ +{ + systems = [ "x86_64-linux" ]; +} diff --git a/flake.lock b/flake.lock index d29d65a69..b94f97353 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,94 @@ { "nodes": { - "nixpkgs": { + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, "locked": { - "lastModified": 1742422364, - "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", + "lastModified": 1741473158, + "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", + "owner": "numtide", + "repo": "devshell", + "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", "type": "github" }, "original": { - "owner": "nixos", + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1754487366, + "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "import-tree": { + "locked": { + "lastModified": 1752730890, + "narHash": "sha256-GES8fapSLGz36MMPRVNkSUWXUTtqvGQNXHjRmRLfJUY=", + "owner": "vic", + "repo": "import-tree", + "rev": "6ebb8cb87987b20264c09296166543fd3761d274", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1755615617, + "narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "20075955deac2583bb12f07151c2df830ef346b4", + "type": "github" + }, + "original": { + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1753579242, + "narHash": "sha256-zvaMGVn14/Zz8hnp4VWT9xVnhc8vuL3TStRqwk22biA=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "0f36c44e01a6129be94e3ade315a5883f0228a6e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "root": { "inputs": { + "devshell": "devshell", + "flake-parts": "flake-parts", + "import-tree": "import-tree", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 5408e8958..bd0de9bc3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,20 @@ { - inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + inputs = { + devshell.inputs.nixpkgs.follows = "nixpkgs"; + devshell.url = "github:numtide/devshell"; + + flake-parts.url = "github:hercules-ci/flake-parts"; + + import-tree.url = "github:vic/import-tree"; + + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; outputs = - { nixpkgs, ... }: - let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; - in - { - devShells.${system}.default = pkgs.mkShell { - buildInputs = with pkgs; [ - php83 - php83Packages.composer - tailwindcss - ]; - }; - - formatter.${system} = pkgs.nixfmt-rfc-style; + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + (inputs.import-tree ./flake-modules) + ]; }; } diff --git a/resources/daily-email-stub.md b/resources/daily-email-stub.md deleted file mode 100644 index 2cc5a6d50..000000000 --- a/resources/daily-email-stub.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: {{ title }} -date: {{ date }} -permalink: {{ permalink }} -tags: - - software-development - # - drupal - # - drupal-planet - # - php - # - podcast -cta: ~ -snippet: | - TODO ---- diff --git a/run.local b/run.local index 08dff63a9..4a3e6c796 100755 --- a/run.local +++ b/run.local @@ -102,7 +102,7 @@ function publish { APP_ENV=prod generate rsync --archive --verbose --compress --update --delete \ - output_prod/ ssh.oliverdavies.uk:/var/www/vhosts/www.oliverdavies.uk + output_prod/ ssh.oliverdavies.uk:/var/www/vhosts/website-sculpin git stash pop } diff --git a/source/_includes/presentation/events-new.html.twig b/source/_includes/presentation/events-new.html.twig index 316c12511..7bf573563 100644 --- a/source/_includes/presentation/events-new.html.twig +++ b/source/_includes/presentation/events-new.html.twig @@ -23,7 +23,7 @@ {% if event.urls %}