How I Configured Zellij Status Bar

As some of you may know, I moved to Zellij a few months ago from tmux. In this post, I will show you have I configured the zellij status bar in nix. So it acts more like how my config did in tmux. My current Zellij status bar. (Optional) Background A bit of background, which you can skip if you’d like. What is zellij? Some of you may be wondering what is zellij/tmux. ...

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

Part 5B: Installing Our Nix Configuration (NixOS Anywhere) as Part of Your Workflow

I wanted to do a short article showing you how you can use your Nix config to install NixOS on a new device. Have your device setup with NixOS in a few commands with all the packages and tooling you want. Previously I was creating my own ISO and then burning that to a USB and using that USB as live media to install my config. I had a custom script nix_installer, which would run automatically when you loaded into the gnome shell. ...

Part 5: Nix as Part of Your Development Workflow

My original plan for this article was to discuss my shell and how I configure it. But I have made some significant changes, to how I structure my Nix configuration and I wanted to go over Why I did that. I mean, likely this will probably happen a lot, as my configuration changes more often than it should 🙈. Anyway, into the main topic. My dotfiles Snowfall what? I recently ported my Nix configuration (dotfiles), to use the snowfall-lib to structure my Nix config. ...

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

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

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

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

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

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

TIL: How to Fix tmux-resurrect on NixOS

TIL: How to Fix tmux-resurrect on NixOS When I moved to NixOS I noticed that tmux-resurrect stop restoring some applications such as man and nvim. Like it used to on my Arch machine. I recently found a solution to my problem (thanks to a lovely chap on the nixos discourse). By adding the following lines to our tmux config: resurrect_dir="$HOME/.tmux/resurrect" set -g @resurrect-dir $resurrect_dir set -g @resurrect-hook-post-save-all 'target=$(readlink -f $resurrect_dir/last); sed "s| --cmd . ...

 2023-09-01 225 words 2 min