From ff09d0cb8be81a374ce804b5354db4328b80adc2 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 18 Jan 2025 11:57:53 +0000 Subject: [PATCH] Add daily email for 2025-01-13 Easy customisation using patches --- source/_daily_emails/2025-01-13.md | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 source/_daily_emails/2025-01-13.md diff --git a/source/_daily_emails/2025-01-13.md b/source/_daily_emails/2025-01-13.md new file mode 100644 index 00000000..e7db57e4 --- /dev/null +++ b/source/_daily_emails/2025-01-13.md @@ -0,0 +1,42 @@ +--- +title: Easy customisation using patches +date: 2025-01-13 +permalink: daily/2025/01/13/patches +tags: + - software-development + - nix +snippet: | + I haven't written a patch file for a while, but I did this week to customise a script I use on my computer and to make everything more maintainable. +--- + +I'm a long-time Vim and tmux user. + +I used them before [I switched to using Neovim full time][0] in July 2021. + +More recently, I've used a script that creates and attaches to tmux sessions based on the directories in my Code directory, making it easy to switch between projects. + +It was based on others by [Jess Archer][1] and ThePrimeagen, although Prime recently created a new version of his as its own project, so I decided to switch to his version. + +But there was one issue - the paths to search for directory names is hard-coded and don't match mine. + +I started by duplicating his and changing the paths, but that would mean missing any future updates and having to maintain my version separately. + +Until I realised I could use his version and apply patches to it for my changes and customisations. + +This is something I'm familiar with from my Drupal contributions, as we used to attach patch files to issues before moving to GitLab and merge requests. + +I was able to make my changes and easily [apply the patch easily as part of my Nix derivation][2]. + +This means I'll get any future updates to the script, keep my changes and Nix will automatically apply my patch whenever I rebuild my system. + +I really like this approach, as I'm no longer duplicating the script and don't have the maintenance overhead whilst still making any customisations I need. + +In fact, there are Linux applications such as dwm, dmenu and st (a simple terminal), all written by suckless.org, that use this approach as the main method of configuration and customisation. + +They release the core package and people write and contribute patch files to customise it as they need. + +Although patches are no longer used on Drupal.org, they're still a great way to customise and contribute to open source software. + +[0]: {{site.url}}/blog/going-full-vim +[1]: {{site.url}}/podcast/25-jess-archer-drush-laravel-prompts +[2]: https://code.oliverdavies.uk/opdavies/dotfiles/commit/5fd27efa502bd48eb7d897acec8aa3344bef2247