TIL: How to Colour Neovim Line Numbers

TIL: How to Colour Neovim Line Numbers Recently I was trying to configure my own neovim config. I wanted the current line I was onto be coloured slighty differently and also the line number to be white. So it’s easier to see the line number and which line I was on. It was not immediately obvious how to do this and took me long to work out than I’d like to admit 😅. ...

 2023-08-24 142 words 1 min

How To Self Host Your Own Atuin Server

In this article, we will go over how we can self-host our instance of Atuin. A tool we can use to sync our shell history across multiple devices. In the previous article, I showed how you can use the official server. However you may want to run your self-hosted one, so no one can access even the encrypted version of your shell history. We will deploy our instance to fly.io. Why fly. ...

How Sync Your Shell History With Atuin in Nix

Atuin is a great tool I recently discovered that can be used to sync our shell history across multiple machines. We can either self-host this or use the “officially” hosted one. In a future article, I will show you how you can self-host your version of Atuin on fly.io. But for this article, I will assume you have a server setup. Your history is end-to-end encrypted so the official server is safe to use and store your history on. ...

TIL: How to Setup Neovim for Nixlang

TIL: How to Setup Neovim for Nixlang I have been recently using NixOS/home-manager and I have been writing a lot of nixlang. To have my system state declaratively set up. I have been doing most of this editing in neovim. It took me a bit of time to work out how to get it set up so there is some basic LSP support and auto-formatting. I created a file called nix. ...

TIL: How to Fix VIA Permission Issues on Linux

TIL: How to Fix VIA Permission Issues on Linux Recently I have been trying to configure my newish Keychron keyboard using VIA. To add a key to be able to take print screens, making use of the layers provided, as my Keychron Q1 PRO doesn’t have a dedicated print key 😓. However, when I opened the app or the website, I would get the following error. If we go to chrome://device-log you should be able to see something like this: Failed to open '/dev/hidraw9': FILE_ERROR_ACCESS_DENIED. ...

 2023-08-02 151 words 1 min

How to Use Neotest Dap With Lazyvim for Golang Development

In this blog post, I will show you how you can easily setup Neotest to make testing easier in neovim and DAP to make debugging your tests is a lot easier. I am using the LazyVim neovim distribution, where these two come as easily installed extra plugins. However, it should be easy enough for you to copy the config over to your neovim lua config. LazyVim even has the config available on its website, you don’t even need to deep dive into the code 😄. ...

TIL: How to get Kanshi to work on NixOS and Hyprland

TIL: How to get Kanshi to work on NixOS and Hyprland I have been using Kanshi to setup my monitor setups automagically depending on which monitors are plugged i.e. if my laptop is docked or not. If it is docked I want my laptop display to be off, when not docked I want it to be on. So my kanshi config file ~/.config/kanshi/config to look something like: I use the name of my monitors as the ports they are plugged into my vary. ...

Part 1: NixOS as part of your Development Workflow

Introduction Dev Machine My main machine for development at the moment is a 12th Generation Intel Framework Laptop. This series has been inspired by Dev Workflow Intro by Josh Medeski. In this series of posts, I will go over how I have set up my developer workflow and explain why I have made certain decisions and why I use certain tools. This series aim to make it less daunting for you to start your journey on improving your developer workflow. ...

Part 0: Hardware as Part of Your Development Workflow

This series has been inspired by Dev Workflow Intro by Josh Medeski. This is sort of a precursor to my series about how I have set up my development workflow. Hopefully, you will be able to pick a few tips and tricks you can add to your development workflow to make it more efficient. Or even give me tips on how I can make my workflow more efficient. In this post we will go over arguably the least important, but at the same time quite important, part of our workflow. ...

My Dotfiles III

My latest iteration of my dotfiles, where I am now using a Laptop as my main development machine (Framework). I’m also using Hyprland as my window manager. Most importantly using NixOS and home-manager to declaratively define the state of my machine i.e. what packages to install, dotfiles. CURRENTLY A WIP 🏠 My dotfiles repo, setup using nixos/home-manager Install 🔥 I wouldn’t recommend just blinding using my dotfiles. They are setup for my specific use-case. ...

Update Nix Packages Using update-nix-fetchgit

Recently I’ve been trying to work out how to update packages that I define declaratively in my Nix config. I think I figured out how to do it using my Nix flake. By running nix flake update and then sudo nixos-rebuild switch --flake ~/dotfiles#framework to update the packages. However, I have some plugins say for tmux which are defined like so: t-smart-manager = pkgs.tmuxPlugins.mkTmuxPlugin { pluginName = "t-smart-tmux-session-manager"; version = "unstable-2023-06-05"; rtpFilePath = "t-smart-tmux-session-manager. ...

Setting Up Tmux With Nix Home Manager

Introduction In this post I will show you how you can setup tmux (plugins) using the nix package manager, specifically using home-manager. I will also show you how you can avoid an issue I encountered where tmux resurrect wasn’t working properly due to plugin ordering. Typically we use the tmux plugin manager to manage our tmux plugins. However, when I moved to NixOS, I wanted to move away from having lots of different ways of managing what is on my system. ...

Why I moved to NixOS

Recently I decided to move from Arch Linux to NixOS. Rather than doing what I should’ve done which was try to use NixOS in a VM first and learn Nix properly. I decided to jump into the deep end and completely delete my current Arch Linux build with Nix. This included replacing my dotfiles setup using DotBot moving them to Nix flakes and home-manager (more on this in a bit). In this post, I’ll go over why I moved over to NixOS, and why I am staying put for now. ...

TIL: How to use NUR with Home-Manager & Nix Flakes

TIL: How to use NUR with Home-Manager & Nix Flakes NUR is the Nix user repository like the Arch user repository (AUR). It exists so that: The NUR was created to share new packages from the community in a faster and more decentralized way. - https://github.com/nix-community/NUR If we want to install packages from NUR in our home manager config which is set up using Nix Flakes. Assuming you build your home manager like ...

TIL: How to Declaratively Setup Mullvad VPN with NixOS

TIL: How to Declaratively Setup Mullvad VPN with NixOS I have recently moved to NixOS, one of the great features of NixOS is that you can set up your entire machine from a single git repo. We can do this declaratively, what we mean by this is we tell nix what we want the state to be and nixos will work out how to get there. For example, we can install Mullvad set various options already. ...

TIL: How to Add Vim Navigation FZF

TIL: How to Add Vim Navigation FZF FZF is an amazing fuzzy finder tool, that is super flexible and you can create some cool cli one-liners with it. For example, I use it with the fish shell plugin to search through my command history (CTRL + R). In this post, I will show you how vim style navigation to the FZF pop-up preview. All we need to do is add the following to the relevant file i. ...

 2023-05-30 101 words 1 min

TIL: How to change the fish greeter

TIL: How to change the fish greeter In this post I will show you how you can change your fish shell greeter from the default Welcome to fish, the friendly interactive shell Type `help` for instructions on how to use fish To something custom, this will run every time you open a new shell! To do this, go to your fish_greeter.fish file which can usually be found at ~/.config/fish/functions/fish_greeting.fish. Where mine looks like: ...

My Development Workflow With Linux

Following on from my previous post about dotfiles and my development workflow (WIP), in this post I will go over my operating system. Arch As the name implies I use Linux as my main operating system. I am a big fan of Linux because not only is free and open-source, it provides a great developer experience where I find tools that just work on Linux. It also is a lot more customisable as compared with Windows or MacOS. ...

My Dotfiles II

I know I recently made a post about my dotfiles but I’ve made a few changes since then, so here are my updated dotfiles. out of date These dotfiles are out of date check out my updated ones here System Overview OS: Arch Linux DE: Gnome Shell: Fish Prompt: Starship Terminal: Alacritty Editor: Neovim (using LazyVim config) Colorscheme: Catppuccin for EVERYTHING!!! Fonts: Mono Lisa Extensions I use the following Gnome extension. ...

My Development Workflow With Alacritty Fish Tmux Nvim

Workflows Change This post is accurate as of date of publish. But likely will go stale, if I update my workflows I will likely publish another post. In this blog post, I will go over my current development workflow using the above tools namely, fish shell tmux and neovim. I’ll be using the dotfiles found here. I aim to move away from using my mouse as much as possible as it just slows me down when my hands are away from my keyboard. ...

My Dotfiles

This post is a quick introduction to dotfiles, accurate as of 25th of April 2023. out of date These dotfiles are out of date check out my updated ones here Dotfiles 🏠 My dotfiles setup using Dotbot. Install 🔥 I wouldn’t recommend just blinding using my dotfiles. They are setup for my specific use-case. I think you’re better picking and choosing what you like 😄. git clone [email protected]:hmajid2301/dotfiles.git cd dotfiles make install profile=arch System Overview OS: Arch Linux DE: Gnome Shell: Fish Prompt: Starship Terminal: Alacritty Editor: Neovim (using astronvim config) Colorscheme: Dracula Icons: Tela-circle-dracula-dark Fonts: Mono Lisa Extensions I use the following Gnome extension. ...

How to Get Code Coverage From Playwright Tests in a Sveltekit App

In this post, I will show you how to get code coverage reports from your Playwright tests in your SvelteKit app. So let’s imagine we are starting with the basic SvelteKit template. First, we need to install: npm i -D vite-plugin-istanbul We need the vite plugin to instrument our code using Istanbul. Istanbul is a tool which allows us to instrument our code such that it can determine which lines were covered by our tests. ...

TIL: How to Get VSCode ESLint to Sort Imports

I use VS Code as my text editor, one of the features I really like about VS Code is that it will format our file on save. Which saves needing to run a CLI tool to do it. For example, running prettier. As part of the formatting on save you can set an option to organise your imports as well. If you open your settings.json, you can add a section like this: ...

TIL: How to Deploy 'Multiple' Sites on One GitLab Page Site

I have a repo which I use to store all of my conference and similar talks. This repo includes any code examples and most importantly the slides. At the moment all the slides are RevealJS “sites”, which means it’s a presentation built in HTML. Now I would like to have all my talks deployed to single GitLab pages site. For example something like: https://hmajid2301.io/talks/an-intro-to-pocketbase/ https://hmajid2301.io/talks/docker-as-a-dev-tool/ So how can we do this ? ...

TIL: How to Mock Classes Using Vitest

TIL: How to Mock Classes Using Vitest Recently I have been creating a SvelteKit app, when creating a new SvelteKit app you get a choice of different things you can add. Such as using vitest for unit testing. I needed to spy on/mock a method in a class, to see if it was called when a button was pressed and, it was called with the correct arguments. Let’s say we have a Button component which looks like this: ...