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

How to Use Cachix Devenv to Setup Developer Environments

In this post, I will go over how you can use Cachix’s devenv tool to help create/set up consistent repeatable developer environments. You could use nix flakes if you wanted to as well, without needing another tool. However, I like how devenv provides a few other “tools” within that we can set up from a single devenv.nix file. Such as pre-commit hooks, container support etc. This blog leverages devenv to create/set up its developer environment. ...

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

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