How to Get sops-nix Working with home-manager Modules

Introduction In this article, I will go over how to get sops-nix to work properly with home-manager. One issue I noticed was that when I used with home-manager modules/options, I would see a string like “%r/secrets/haseeb/…”. The %r would not be replaced. Relevant Issue: https://github.com/Mic92/sops-nix/issues/28 Assumption I will assume you have already setup sops-nix and are using it. In the sense, you have a .sops.yaml file and are already using it with NixOS. ...

TIL: How to fix being unable to change locations in Mullvad VPN on NixOS

Recently, I was unable to change the location on my Mullvad VPN from other thing other than sweden. Even using the mullvad cli tool I would keep getting errors like: invalid argument for type conversion: missing custom lists settings it turned out to somehow a mismatch in versions where everything was running 2023.6 but my mullvad cli was using 2023.5. So I ended up fixing this by changing my config to: ...

TIL: How to Fix `Verification Failed` With Ventoy USB

TIL: How to Fix Verification Failed With Ventoy USB Recently, I tried to boot with my Ventoy USB on my new AMD motherboard Framework. However, I was getting a which looked like Verification failed:(0x1A) Security Violation. It turns out this was because secure boot was turned on. So we needed to turn it off initially to boot off the Ventoy. You can follow the instructions here. We can then turn on secure boot after, I will do a future post how we can do this with NixOS. ...

Part 4: Wezterm Terminal as Part of Your Development Workflow

I will preface this article by saying, out of all the tools/apps in this series, this is probably the least important decision you will make. You can use any terminal editor and basically still have the same development workflow as me. Some common terminal emulators include: kitty alacritty foot wezterm Background After a break that was probably too long in this series, we’re on to the next part looking at our terminal and how we set it up. ...

TIL: Show to Use the Media Keys on a ZSA Keyboard With Hyprland

TIL: Show to Use the Media Keys on a ZSA Keyboard With Hyprland Recently, I started using a ZSA Voyager split keyboard, moving to this keyboard has some advantages but the last thing I felt I was missing from my old keyboard (which has a volume knob) was being able to control the volume. So I set up the key maps in their software (Oryx) however, I noticed that binding were not working. ...

2023 In Summary, My Year of The Terminal

For once, I am actually doing a year in review, to go over some of the things I’ve learnt over the last year. Part of the reason is this has been probably my most transformative year since I have been a software engineer. I have become far more terminal development driven, if that is a phrase one can use. What I mean is I changed my development workflow to leverage being in the terminal more. ...

TIL: How to Use Default Values in docker-compose.yml

TIL: How to Use Default Values in docker-compose.yml Sometimes we want to use env variables in our docker-compose files like so: services: client: image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/nginx ports: - 8000:80 Here we are going to use the GitLab CI dependency proxy to pull our Nginx image, so we can speed up our pipelines but also avoid being rate limited by docker hub. However, when running this locally, we will need to make sure the CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX env variable is set. ...

TIL: How to Use Open Buffers When Debugging With Neovim's DAP Plugin

TIL: How to Use Open Buffers When Debugging With Neovim’s DAP Plugin I had an issue that whilst debugging my Golang tests in Neovim, the buffer I was focusing on would always change to the breakpoint. Even when the buffer was open and visible already, say I had the code with the breakpoint on the left buffer and the tests I was starting the debugger from on the right buffer. ...

TIL: How to Use Tailscale to Connect to K3S PI Cluster

TIL: How to Use Tailscale to Connect to K3S PI Cluster So what do we do if want to connect to our K3S cluster running our RPIs, but we are not on the same network/at home. Well we can look to use a VPN, in this article we will be using tailscale. It is super easy to setup on NixOS, and we need very little config for Tailscale. It also has a generous free tier, which will be more than enough for our home lab use case. ...

How to Deploy K3s With Colmena on Pi Cluster

In this post, we will go over how we can deploy K3S on our PI cluster we have set up. Which is running NixOS, and we can also pass secrets using sops nix based on the previous parts of this series. Some of you maybe wondering what is K3S, it is a Kubernetes distribution which is tiny i.e. the binary is only 50 MB. It also has fewer dependencies. Make it perfect our PI cluster and home lab and IoT apps. ...

TIL: How to Fix a NTFS Drive on NixOS

TIL: How to NTFS Drive on NixOS Recently, I was trying to open an NTFS drive on my NixOS machine; however, the drive was corrupted. So I did the following to fix the drive. nix-shell -p ntfs3g ntfsfix /dev/sda1 Where /dev/sda1 is the broken drive. This was enough for me to be able to mount the drive and access the files on it. I didn’t need to fix it on a Window machine. ...

TIL: How to Append to a Config Option String in Nix

TIL: How to Append to a Config Option String in Nix Recently on my laptop I had to add some extra config settings to my Hyprland config. Rather than polluting my hyprland.nix file with if, else depending on the host. I wanted to add the extra config in the home.nix of the host. So it’s contained within that host. Where my home.nix is the entry point for my home-manager config for that host. ...

 2023-12-01 181 words 1 min

TIL: How to Use Sops Nix With Colmena

TIL: How to Use Sops Nix With Colmena If we are using colmena, how can we set it up when we deploy a secret, for example when deploying k3s the token? i.e. services.k3s.tokenFile = "/my.token";. So to do this first, I will assume you already have a colmena config and sops-nix setup in your config. First, let’s set up our hosts, in this case RPIs which already come /etc/ssh/ssh_host_ed25519_key ssh key we can turn to an age key, i. ...

How I Manage My Raspberry Pi Cluster Using Colmena

So in the previous article I showed you how I had set up my 4 RPI (Raspberry Pi) cluster and put NixOS on the machines. They are now connectable over SSH using just their hostnames, i.e. ssh [email protected]. Initially we deployed NixOS and a basic configuration to each of the RPIs manually. We want to automate this process rather than deploying to each machine manually. I looked at bento, but couldn’t quite work out how to make it work for my use case. ...

TIL: How to Set the Path Variable When Using Ubuntu With Nix (Home Manager)

TIL: How to Set the Path Variable When Using Ubuntu With Nix (Home Manager) As per some of my recent articles, you will be aware I am using Hyprland (tiling manager) on Ubuntu and managing the config using nix (home-manager). I was having issues where for some reason it wouldn’t set the PATH variable correctly. On my NixOS machine, the following would be fine: bind=,XF86AudioRaiseVolume,exec, volume --inc bind=,XF86AudioLowerVolume,exec, volume --dec However, on Ubuntu I needed to provide the full path: ...

How to Install Hyprland on Ubuntu (22.04)

As you may know from my previous articles, my work laptop is an Ubuntu (22.04) laptop. However, on the rest of my devices I use NixOS with Hyprland as my tiling window manager. I wanted to be able to use Hyprland on my laptop as well, I tried using Sway and, it worked mostly pretty well, but it was yet another to manage and there were some slight differences. Also, I like the animations on Hyprland 😅. ...

TIL: How to Title Your Terminals When Running Tmux

TIL: How to Title Your Terminals When Running Tmux I have been tmux with the foot terminal and when trying to share my screen I couldn’t work out which terminal to share based on the name. Since they are running tmux, all the terminals were titled terminal - t. To fix this and name it after what is running (and where) in tmux, i.e. foot blog/nvim. We can do this by adding the following to our tmux config: ...

 2023-11-22 130 words 1 min

TIL: How to Start Gnome Wayland Session From TTY

TIL: How to Start Gnome Wayland Session From TTY Recently, I moved to Hyprland on Ubuntu. I wanted to start gnome in another TTY (teletype). It was more effort to find than I expected: # Go to teletype CTRL+ALT+1 dbus-run-session -- gnome-shell --display-server --wayland That’s it, short and sweet, this post! You now started gnome in a Wayland session.

How I Setup My Raspberry Pi Cluster With Nixos

Background Recently, I proceeded to experiment with some Raspberry PIs (RPI) that I had lying around. I wanted to do something with them, so I decided I would turn them into a k8s cluster and put various random tools that might be nice to have on it. Such as a GitLab runner, Jellyfin media server & pi hole for ad blocking. Hardware The list below shows the things I used to set up my rpi cluster. ...

TIL: How to Debug a Test in Golang With Build Tags in Neovim

TIL: How to Debug a Test in Golang With Build Tags in Neovim I was having issues with my debugger today (well technically yesterday because I am publishing this a day later to spread out my blog posts but same difference) and it took me a few hours to realise what was going on. In my case, I was trying to debug a test written in Golang using nvim-dap-go on Neovim. ...

Part 3: Hyprland as Part of Your Development Workflow

Preamble Now we have looked at our choice of hardware, which OS to use and specifically, how to configure NixOS (at a high-level), using a git repository. In this part, we will go over which window manager to use. There are two main types we could use here. Either a desktop environment like Gnome or KDE. Which comes with batteries included, it provides us with everything we need and we don’t need to configure much to get stuff working. ...

TIL: How to Install Neovim Nightly Using Nix Home Manager (and NixVim)

TIL: How to Install Neovim Nightly Using Nix Home Manager (and NixVim) Recently, I wanted to install the nightly version of Neovim (version 0.10) because it supports inlay hints. However, on nixpkgs the latest version of Neovim as of writing is 0.9.4. So how can we get the nightly release? Using nix/home-manager. Simple, we can use an overlay that will add the Neovim nightly package with the nightly. Assuming we are using nix flakes. ...

TIL: How to Set Network Manager Priority to Use Wired Connection Over WIFI

TIL: How to Set Network Manager Priority to Use Wired Connection Over Wi-Fi If you use network manager on Linux and have both Wi-Fi and wired connection. You may want to prefer using a wired connection over Wi-Fi, due to stability. To do open the nm-connection-editor, if you are using Nix, you can download it from nixpkgs like usual. Higher number means higher priority. So for our wired connection I set the priority to 100 (it was previously -1) and then for our Wi-Fi connection I set the priority to 1. ...

A Simple Way to Convert JSON to Nix Attribute Sets

In this post, I will show you how you can take some JSON and convert it into a Nix attribute set. This was particularly useful when I was creating my waybar configuration. Which is usually in JSON, but defined in my home-manager Nix config it has to be in nixlang. So given this: "custom/notification": { "tooltip": false, "format": "{icon}", "format-icons": { "notification": "<span foreground='red'><sup></sup></span>", "none": "", "dnd-notification": "<span foreground='red'><sup></sup></span>", "dnd-none": "", "inhibited-notification": "<span foreground='red'><sup></sup></span>", "inhibited-none": "", "dnd-inhibited-notification": "<span foreground='red'><sup></sup></span>", "dnd-inhibited-none": "" }, "return-type": "json", "exec-if": "which swaync-client", "exec": "swaync-client -swb", "on-click": "swaync-client -t -sw", "on-click-right": "swaync-client -d -sw", "escape": true }, We want it to look something like: ...

 2023-11-06 253 words 2 min

How Can You Export Your Atuin History to Fish History?

I have made an post in the past about how you can set up Atuin to sync share history across multiple devices. Whilst this works great and does the job, fish shell doesn’t have the same history that Atuin does. Sometimes we want to have better suggestions in Fish. For example, when you start to type fish shell will suggest the last command in your history that best matches what you are typing (see example below). ...