Add daily email for 2025-01-22

Why I use nixpkgs-unstable
This commit is contained in:
Oliver Davies 2025-01-27 00:53:51 +00:00
parent 911d5e736b
commit dd7eeab810

View file

@ -0,0 +1,37 @@
---
title: Why I use nixpkgs-unstable
date: 2025-01-22
permalink: daily/2025/01/22/nixpkgs-unstable
tags:
- software-development
- nix
snippet: |
Why do I use nixpkgs-unstable by default?
---
In the majority of my `flake.nix` files, such as the one [I've been experimenting with for Drupal projects][0], I use `nixpkgs-unstable` as my primary input.
The nixpkgs package manager has two major releases a year, in May and November, which would be 24.05 and 24.11 for 2024 respectively.
Using `nixpkgs-unstable`, I get the latest packages and NixOS options and don't need to wait for the next major stable release.
But doesn't that make things more likely to break when updating?
The number of backwards incompatible changes and breakages on unstable are minimal, but I'd rather deal with small issues and updates regularly rather than only twice a year.
Small updates more often are better, in my opinion.
But, what if there is an issue with a package that I'm using, such as a build issue, regression or incompatibility?
With flakes, I can import multiple versions of nixpkgs in the same configuration and use them where the configuration I need to.
I need to in one project, I've added an input with nixpkgs pinned to a specific Git commit in the nixpkgs repository as some packages are using outdated versions and are no longer present in the latest releases.
It's not all or nothing, I can pick which packages to be unstable and which I want to use stable or use older versions.
See [my dotfiles repository][1] for an example, where I have four versions of nixpkgs imported - including unstable and master, which is even newer.
Every input is still locked in the `flake.lock` file, so everything is still reproducible whichever versions of nixpkgs I decide to use.
[0]: {{site.url}}/daily/2025/01/19/minimum-viable-development-environment
[1]: https://code.oliverdavies.uk/opdavies/dotfiles/src/commit/a5c1c891020c5026ca1c2d83afd6cbe8002a136c/flake.nix