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

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

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

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

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

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

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

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

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.

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

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