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). ...

TIL: How to Use Clipboard Data as File Input in Bash

TIL: How to Use Clipboard Data as File Input in Bash Recently, I wanted to run a bash script where it needed to receive a JSON file as input. However, the JSON I had was taken from somewhere on the internet. In this case, it was taking a JSON blob and converting it to a nix attribute set. However, I didn’t want to save the contents to a file beforehand. ...

 2023-11-01 129 words 1 min

How to Setup a Go Development Shell With Nix Flakes

As you may know, I have been using Nix/NixOS for the last few months. I finally started doing some development, after spending lots and lots and lots of time tweaking my setup (and neovim). As part of starting to do some real development work, I am now trying to leverage devshells with Nix flakes. I like the concept of Nix devshells, I have tried using Docker dev containers in the past, but the issue I had with those was adding my tools such as shell (fish) or cli tools was not easy. ...

Part 2: How to Setup Nixos as Part of Your Development Workflow

Premable In this second part of the series, we will look at how we can not set up NixOS past installation. How we can install software and various other tools. After part 1 we should have NixOS installed, mind you since I’ve written that blog post I found a way to create a custom ISO image from my Nix config. This ISO contains a custom install script, the main advantage being able to use a tool called disko to partition our disks. ...

TIL: How to Fix Networking Issues in a Libvirt VM and Mullvad VPN

TIL: How to Fix Networking Issues in a Libvirt VM and Mullvad VPN Recently, I was trying to run a libvirt virtual machine, created using virt-manager. The VM was running NixOS and somehow no matter what I did it would not connect to the internet. I was running Mullvad as my VPN, and it turned out this was the app causing issues, I had to turn on Local network share 1. ...

TIL: How to Disable Linters in Golangci Lint for Test Files

TIL: How to Disable Linters in Golangci Lint for Test Files Today (for once), I ran golangci-lint run and it failed on CI with the following error: internal/options/parser_test.go:13: Function 'TestParse' is too long (69 > 60) (funlen) func TestParse(t *testing.T) { task: Failed to run task "lint": exit status 1 Where my .golangci.yml file looked like this: run: timeout: 5m skip-dirs: - direnv linters: enable: - bodyclose - dogsled - dupl - errcheck - exportloopref - funlen - gochecknoinits - goconst - gocritic - gocyclo - gofmt - goimports - gomnd - goprintffuncname - gosec - gosimple - govet - ineffassign - lll - misspell - nakedret - noctx - nolintlint - revive - staticcheck - stylecheck - typecheck - unconvert - unparam - unused - whitespace So basically we want the ability to turn off funlen for our tests (and other linters). ...

How to Create Systemd Services in Nix Home Manager

I recently learnt in home-manager (Nix) you can run systemd services as your own user. This is nice because we don’t need “sudo” permissions to do so. I also prefer to have as much of my config as possible in home-manager, again I don’t need to run “sudo”. Which is probably safer running apps in the least privileged mode. In my case, I wanted to run an attic, a binary cache, watch store command which uploads any changes to /nix/store to my binary cache. ...

TIL: How to Colour Dap Breakpointed Line in Neovim

TIL: How to Colour Dap Breakpointed Line in Neovim I wanted to change the background colour of the line when it was stopped during debugging using DAP with neovim. To make it easier to see where we are currently breakpointed. We already have a highlight group called DapStopped. Which in my case is defined as: DapStopped = { bg = C.grey }. Then we need to assign the custom highlight group, the key bit being linehl for our use case. ...

TIL: How to Fix Package Binary Collisions on Nix

TIL: How to Fix Package Binary Collisions on Nix Recently I wanted to use GNU parallel, a nifty little tool we can use to run tasks in parallel, shock horror I know. I already have the moreutils package installed using nix (home-manager). So I added this: home.packages = with pkgs; [ parallel moreutils ] Then I ran the home manager switch like usual, I got the following error. error: builder for '/nix/store/vh6i81xhf6pvybdpall8z8l8y0i6mr8p-home-manager-path. ...

 2023-10-02 181 words 1 min

Setup Ventoy on Nixos

Introduction Typically when we want to install a new OS we use an ISO to create a bootable USB drive. We can then plug this into our device, say laptop, and boot from that USB and install our OS. However, typically you can only put a single ISO on a USB. So what if wanted a USB with say Window, Arch Linux, TailsOS and NixOS how could we do that? ...

TIL: How to Use fzf.fish History Search

TIL: How to Use fzf.fish History Search I use Fish Shell with fzf and fish fzf plugin. I installed fzf using nix and home-manager: { programs.fzf = { enable = true; enableFishIntegration = false; }; } It adds fzf-history-widget script, which is bound to ctrl+r, shell reverse history search. Which we can see when we run this: bind | grep -e fzf-history-widget -e fzf-file-widget Whereas I wanted to use the _fzf_search_history which is made available by that fish fzf plugin. ...

My NixOS Dotfiles Explained

In this post, we will just go over the basics of how we can configure our setup using a git repo, nix flakes and home-manager. I will go over how I structured my nix config. Not an in-depth tutorial Note this will not be an in-depth guide into NixOS/Home Manager itself. That could well be a series on its own. We will just go over the main ways I configure NixOS/Nix and why I do it the way I do. ...

TIL: How to Check if Another Option Is Set in Home Manager (Nix)

TIL: How to Check if Another Option Is Set in Home Manager (Nix) Recently I was adding sway to my nix config (setup via home-manager). I already had Hyprland config, I wanted both sway and Hyprland to use my waybar config with some slight differences. So basically I want to check if the current host machine is using Sway or Hyprland (I am assuming we will only use one). The main reason for using Sway is my work laptop uses Ubuntu 22. ...

TIL: How to Access System in Home Manager Using Flakes

TIL: How to Access System in Home Manager Using Flakes Recently I needed to install devenv using flakes in home-manager. One of the things I needed to pass to was the type of system to install on i.e. "x86_64-linux". So as I temp hack I had something like: inputs.devenv.packages."x86_64-linux".devenv. However I was able to access the system using the pkgs attribute like so: { inputs, pkgs, ... }: { home.packages = [ inputs. ...