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

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

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

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

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