From 575aa31778fdea58e96fa58f698575f79524ce31 Mon Sep 17 00:00:00 2001 From: Perchun Pak Date: Sat, 17 Jan 2026 23:22:53 +0100 Subject: [PATCH] Document that you can patch nixpkgs --- src/content/docs/guides/lib/generic.md | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/content/docs/guides/lib/generic.md b/src/content/docs/guides/lib/generic.md index 0ad3f71..a792202 100644 --- a/src/content/docs/guides/lib/generic.md +++ b/src/content/docs/guides/lib/generic.md @@ -74,3 +74,45 @@ the same names as the attributes you add. }; } ``` + +## Patching nixpkgs + +Patching nixpkgs is very easy with snowflake; you can just provide patches using `channels..patches`. +Note that patches are specific to the channel. + +```nix +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.11"; + + snowfall-lib = { + url = "github:snowfallorg/lib"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs: + inputs.snowfall-lib.mkFlake { + inherit inputs; + src = ./.; + + channels.nixpkgs.patches = [ + ./someAwesomePatch.patch + # poetry is currently broken! + (fetchpath { + url = "https://github.com/NixOS/nixpkgs/pull/480936.diff?full_index=1"; + hash = "sha256-fW5i44hjG7rb6aBQtzj5Q7+aIWbnNMoR+T3ppxhvcK0="; + }) + ]; + + channels.nixpkgs-stable.patches = [ + # backport of some important PR + (fetchpath { + url = "https://github.com/NixOS/nixpkgs/pull/480745.diff?full_index=1"; + hash = "sha256-iJjlcZEQW8M0vurPLUGmwOpga8B/NPPilc5llk1XidQ="; + }) + ]; + }; +} +```