How to Set up Cloudflare Tunnels With Traefik (In NixOS)

Recently, I was setting up Navidrome, kind of like a self-hosted Spotify, in my home lab and I wanted to set it up to use proxy auth in Authentik. But to do this I needed to use with a reverse proxy, i.e. Traefik. In this article I will show you how to you can point your Cloudflare tunnel to Traefik and have that forward the request to the service. Prerequisite In this article, I assume you are already familiar with Cloudflare Tunnels and Traefik. ...

TIL: How to Cancel Stale Pipelines in GitLab CI

TIL: How to Cancel Stale Pipelines in GitLab CI Today I learnt that we can cancel old pipelines in MRs. For example, you push a new commit, and you don’t care about the old pipeline running any more. You want to cancel them to save CI minutes etc. Here is an example, you can see the 2nd pipeline is cancelled: We need to add this to our .gitlab-ci.yml file. Where the default. ...

TIL: How to Get Shell Completions in Nix Shell With Direnv

TIL: How to Get Shell Completions in Nix Shell With Direnv When shell completions don’t work with direnv, you may need to use nix develop to load the shell manually. Background I am using nix-direnv, with nix devshell to autoload into my development environments. I changed the directory and the devshell is automagically loaded without me doing anything, which is great. Provides me with a bunch of tools specific for that project. ...

How to Set up Authentik Forward Auth With Traefik on NixOS

In this post, I will show you how you can set up forward auth for a single host in Authentik, with Traefik as our reverse proxy on NixOS. This is particularly useful way to protect apps that don’t have any built in auth. Authentik is a great app which can handle authentication for almost all of our home lab. So we only need to log in with Authentik, to log in to any of our apps. ...

Setup TLS Certificate With Traefik & Tailscale on NixOS

Recently I have been playing around with running a homelab directly on a NixOS machine without kubernetes. I didn’t want to bother to have to setup certificates using Traefik (DNS challenge) and Cloudflare. I wanted to use the certificate that comes with Tailscale (wireguard VPN I use to connect to my home lab). In this post I will show you how I set this up as a Nix module. Nix Let us look at the relevant Nix code. ...

How to Configure Kitty on Nix to Show Emojis

Recently, I was trying to configure the terminal emulator Kitty with Nix and Stylix, and I was having issues with it showing emojis. It took me a lot longer to figure out than I would like to admit. So I decided to write a blog post, showing you how I did it and perhaps saving you some time. I did this in my home-manger config. First we install the Symbols Nerd Font, there are two ways we can normally add nerd fonts. ...

How I Set up BTRFS and LUKS on NixOS Using Disko

In this post, I will show you how you can declaratively partition our drives using Nix(OS). TL;DR; We can use a tool called disko to partition our drives declaratively and combine it with NixOS anywhere for a remote install. Showing an example setting up LUKS encryption with BTRFS file system. Background If you’re like me, then when you started playing with NixOS, You found yourself constantly reinstalling it and starting again. ...

How I Configured Zellij Status Bar

As some of you may know, I moved to Zellij a few months ago from tmux. In this post, I will show you have I configured the zellij status bar in nix. So it acts more like how my config did in tmux. My current Zellij status bar. (Optional) Background A bit of background, which you can skip if you’d like. What is zellij? Some of you may be wondering what is zellij/tmux. ...

Part 6: Fish Shell as Part of Your Development Workflow

After a long break, I am again writing about my workflow. The big issue I have with this series is that my workflow is kind of always in flux and changing. Which maybe is a bad thing. I just need to pick some tools and stick to it. Rather than trying four different terminal emulators, i.e. alacritty, kitty, foot and wezterm. However, over the last ~5ish years, one thing that has remained pretty constant is my use of fish shell. ...

Rewriting a Python script as a Bash one-liner

In this post, I will describe how I went about replacing a Python with a bash liner and how it decreased the runtime from 30 seconds to 1 second Background For this blog, I used to have a Python script which I would use to generate open graph images. These are images you sometimes see in apps when you share a link. For example: Essentially, what it would do is go through every post in my blog repository. ...

Migrating My Homelab to Flux

Background This series is a continuation of the other series. I have since updated my home lab, removing the RPIs and replacing them with some mini pcs. As part of this change I am now using deploy-rs instead of colmena. As its easier to integrate into my own flake, and it won’t roll out the change if breaks the networking, i.e. you cannot ssh to the machine. Why move away from Pulumi? ...

TIL: How to Fix Did No Resolve Alias Errors in Podman

TIL: How to Fix Did No Resolve Alias Errors in Podman Recently, I was trying to pull docker images using podman, on an Ubuntu laptop and was getting an error which looked something like: Error: error creating build container: short-name "node:18.17" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf" This is because Podman doesn’t allow us to use short names, by default we need to specify the registry i. ...

TIL: How to Fix DNS Resolution Issues in K3s Related to Flannel Networking

TIL: How to Fix DNS Resolution Issues in K3s Related to Flannel Networking Recently, I was trying to set up the kubernetes-dashboard, to make it easier to monitor my k8s cluster. I however noticed I was getting the following error: … > add-kubernetes-dashboard via 🐹 v1.22.2 via  via ❄ impure (nix-shell-env) k$ kubectl logs -n monitoring kubernetes-dashboard-kong-75bb76dd5f-b27ll 2024/05/05 20:55:21 [error] 1319#0: *274054 [lua] init.lua:371: execute(): DNS resolution failed: failed to receive reply from UDP server 10. ...

How I Fixed Hibernate on My NixOS Machine

tl:dr; Wi-Fi drivers were stopping the PC from suspending. I am using an Ethernet cable to connect my PC. So didn’t need the Wi-Fi drivers. By adding them to a blocklist. I think you only need the 2nd one in the list. { boot.blacklistedKernelModules = [ "ath12k_pci" "ath12k" ]; } Recently, I upgraded my PC to an am5 machine with an X670E Gigabyte motherboard. However, when I did this hibernate was left broken, alongside suspend. ...

How to Add reveal-hugo to a Hugo Site

What we are trying to achieve hosting RevealJS slides on our Hugo blog like so. The markdown that the slides are built from It can be found here Background Recently, I did a talk at the Conf42 conference shameless plug here. At the time I was working on the slides using Reveal.js, as I did for all of my slides as I can create a slideshow using just plain markdown. I hosted all of my talks in a separate repository. ...

How to Deploy Kubernetes Dashboard Using Pulumi to a K3s Cluster

Kubernetes Knowledge I don’t know a ton about Kubernetes. I am still learning, hence this home-lab project. So there may be better ways to do stuff that I have described below. If that is the case, please let me know! Just take what I say with a pinch of salt. It’s been a while since I made an update about my home lab, also an aside, I should’ve given this series a better name. ...

How to Use Env Variables With Viper Config Library in Go

This is part of a series of where I am going to blog about issues I had building my CLI tool OptiNix and documenting how I resolved those issues. Most will be random things not specifically related to building CLI tools. In this example, we will use the viper library. Mainly because I am already using cobra, the library to help us make CLI tools. From the same author and wanted to see how well they integrated. ...

TIL: How to Pull Submodules in a Nix Derivation

TIL: How to Pull Submodules in a Nix Derivation Recently, I was trying to create a derivation which needed to pull git submodules as well. I was getting an error which look something like this: data/meson.build:76:0: ERROR: Nonexistent build file 'data/submodules/meson.build' It was coming from this derivation https://gitlab.com/hmajid2301/dotfiles/-/blob/c153de146a3bf9339cbef013ac65bc32e6305c8e/packages/gradience/default.nix for building the latest version of gradience. It turns out when we do a fetchFromGitHub we need to explicitly tell it to also pull submodules, which makes sense. ...

 2024-05-12 142 words 1 min

Part 5B: Installing Our Nix Configuration (NixOS Anywhere) as Part of Your Workflow

I wanted to do a short article showing you how you can use your Nix config to install NixOS on a new device. Have your device setup with NixOS in a few commands with all the packages and tooling you want. Previously I was creating my own ISO and then burning that to a USB and using that USB as live media to install my config. I had a custom script nix_installer, which would run automatically when you loaded into the gnome shell. ...

Part 5: Nix as Part of Your Development Workflow

My original plan for this article was to discuss my shell and how I configure it. But I have made some significant changes, to how I structure my Nix configuration and I wanted to go over Why I did that. I mean, likely this will probably happen a lot, as my configuration changes more often than it should 🙈. Anyway, into the main topic. My dotfiles Snowfall what? I recently ported my Nix configuration (dotfiles), to use the snowfall-lib to structure my Nix config. ...

Part 4b Foot Terminal as Part of Your Development Workflow

Earlier this year I spoke about using Wezterm as my terminal of choice, however since then, I have swapped back to the foot terminal emulator. I also have kitty available on my system. However, I don’t use it much. In this article, I want to add a quick addendum to why I moved away from Wezterm. Note as per that post, this is again not a super important decision, almost any full colour supported terminal will basically like every other. ...

TIL: How to Fix Neorg Metadata Treesitter Issues With Nixvim

TIL: How to Fix Neorg Metadata Tree Sitter Issues With NixVim If you are like me, you may be configuring your Neovim configuration using NixVim. Which is a “framework” making it easier to configure Neovim using mostly Nix configuration. Allowing us to keep most of our config in one language, at least in my case. I started using Neorg to manage my notes and to-do lists in my “second-brain”, but noticed that the metadata part was not being highlighted as I expected. ...

My Favourite Neovim Plugins

In this post, I will go over some of my Neovim plugins I really like that aren’t as well known. So I won’t really be talking about telescope, LSP or nvim-cmp. As most users know about these plugins and use them extensively in their configuration. oil.nvim Link: https://github.com/stevearc/oil.nvim oil.nvim creates a file explorer but as a true vim buffer, so it’s effortless to create new files and folders. We can also move files easily. ...

TIL: How to Set up Layouts in Zellij That Use Direnv and Nix

TIL: How to Set up Layouts in Zellij That Use Direnv and Nix I have been using Zellij for a while now. I tried to set up layouts for one of my personal projects. So that we could have tests and linting running and any other tasks we may want whilst doing development 1. However, I had an issue working out how to call commands that required direnv and nix to set up development environments. ...

TIL: How to Get Sway Notification Center to Play Nice With Waybar

TIL: How to Get swaync to Play Nice With Waybar I added Sway Notification Center as my notification manager and added a small “widget” to my Waybar, so I can see how many notifications I have and silence notifications by clicking on it. However, I found when I opened the swaync sidebar, in my case by right-clicking on the icon. I found that I could not click on anything else on my Waybar like workspaces. ...