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

TIL: Clean Up Tmux Service When Removed by Home Manager

TIL: Clean Up Tmux Service When Removed by Home Manager Recently I stopped using tmux to try zellij, however I noticed when I removed tmux from my nix config. I was getting the following error, when rebuilding my home-manager config: The user systemd session is degraded: UNIT LOAD ACTIVE SUB DESCRIPTION ● tmux.service loaded failed failed tmux default session (detached) Legend: LOAD → Reflects whether the unit definition was properly loaded. ...

TIL: How to Run Android Emulator Using avd on Hyprland

TIL: How to Run Android Emulator Using avd on Hyprland Recently, I was having issues when trying to run an Android Emulator using Android Studio (avd). When I would try to run an Emulator from the device manager, I would get the following The emulator process for avd xxx has terminated error. Looking deeper into the logs at ~/.local/cache/Google/AndroidStudio2023.1/log/idea.log, I noticed the following: 2024-02-20 12:01:45,859 [ 781674] INFO - Emulator: Pixel 7 Pro API 34 - Android emulator version 33. ...

How to Load Secret Environment Variables in Fish Shell

Often you want to load environment variables that are secrets, and you don’t want them in your shell history. Such as your GitHub Access Token or API Token when making requests with curl. One easy solution is to load environment variables from a file, say an .env file. Now, since I am using fish shell, loading env variables from a file like we do in bash and zsh won’t work, i. ...

 2024-02-28 281 words 2 min

TIL: How to Add New Vim Plugins to nixpkgs Repository

Recently, I wanted to add a Neovim plugin to nixpkgs, so I can then add it to NixVim. I tried following the guide from the docs. However, I kept getting the following errors: nix-shell -p vimPluginsUpdater --run vim-plugins-updater error: … while calling the 'derivationStrict' builtin at /builtin/derivation.nix:9:12: (source not available) … while evaluating derivation 'shell' whose name attribute is located at /nix/store/whhzjfgalghpm34irclh01c0afynmyll-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:300:7 … while evaluating attribute 'buildInputs' of derivation 'shell' at /nix/store/whhzjfgalghpm34irclh01c0afynmyll-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation. ...

TIL: How to Fix Firefox Rendering Bug in Hyprland

TIL: How to Fix Firefox Rendering Bug in Hyprland Recently, I had an issue with my Ubuntu laptop running Hyprland, when running Firefox it had this ugly border around it. Which looked something like this: You can see a weird border around the browser, and if you try to view some of the context menus, they appear small and difficult to read. Fix As per this Reddit thread 1. There are two fixes, one upgrade to version 0. ...

How to Move Files Between Two Git Repositories and Keep its History

Background Recently, I had to move one of my to-do files from its own repository, todo, to my second-brain repository. So I could better keep track of my ideas, and tasks to be done. However, I realised just copying the file over I would lose all the git history the file had. Strictly speaking, I don’t need the git history of that file, as the most important thing is the current tasks to be completed. ...

 2024-02-11 469 words 3 min

How To Create A Custom NixOS ISO

Introduction In this post, I will show you how you can create a custom NixOS ISO image, using our normal nix configuration as if it another machine/device. Some of you may be wondering why you want to do that vs using the normal ISO. Particular for installing on my machines I would like to have my device setup in one go, rather than previously I would install using the normal ISO, then clone my dot files and build my config again. ...

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