From 4108b4eb0eeec94d772e9cf8db6857100f9ec263 Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 9 Sep 2023 06:18:41 -0500 Subject: [PATCH] Added nixpkgs patches documentation --- README.org | 20 ++++++++++++++++++++ flake.nix | 1 + patches/README.org | 13 +++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 patches/README.org diff --git a/README.org b/README.org index c5c9257..ebc67f0 100644 --- a/README.org +++ b/README.org @@ -38,6 +38,26 @@ I have my modules separated into two groups: More detailed information on these specific modules are in the [[./system][system directory]] and [[./user][user directory]] respectively. +** Patches +In some cases, since I use =nixpgs-unstable=, I must patch nixpkgs. This can be done inside of a flake via: +#+BEGIN_SRC nix + nixpkgs-patched = (import nixpkgs { inherit system; }).applyPatches { + name = "nixpkgs-patched"; + src = nixpkgs; + patches = [ ./example-patch.nix ]; + }; + + # configure pkgs + pkgs = import nixpkgs-patched { inherit system; }; + + # configure lib + lib = nixpkgs.lib; +#+END_SRC + +Patches can either be local or remote, so you can even import unmerged pull requests by using =fetchpatch= and the raw patch url, i.e: https://github.com/NixOS/nixpkgs/pull/example.patch. + +I currently curate patches local to this repo in the [[./patches][patches]] directory. + ** Profiles I separate my configurations into [[./profiles][profiles]] (essentially system templates), i.e: - [[./profiles/personal][Personal]] - What I would run on a personal laptop/desktop diff --git a/flake.nix b/flake.nix index 2bee086..4bc7c35 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,7 @@ spawnEditor = if (editor == "emacsclient") then "emacsclient -c -a 'emacs'" else (if (editor == ("vim" || "nvim" || "nano")) then "$TERM -e $EDITOR" else editor); + # create patched nixpkgs nixpkgs-patched = (import nixpkgs { inherit system; }).applyPatches { name = "nixpkgs-patched"; src = nixpkgs; diff --git a/patches/README.org b/patches/README.org new file mode 100644 index 0000000..e91c04d --- /dev/null +++ b/patches/README.org @@ -0,0 +1,13 @@ +#+title: I never thought I'd have to do this, but here we are +#+author: Emmet + +Since I use =nixpkgs-unstable= (I am an Arch user by heart), there are some cases where certain packages will break or fail to build (usually due to my extremely customized, non-standard system). + +With Nix, I /could/ just rollback everything and wait to update until an upstream patch fixes things, but if it's a quick fix, I'd rather just patch it in immediately so that everything else can stay up to date. + +** List of Patches +Here is a list of patches in this directory, along with a more detailed description of why it's necessary: + +| Patch | Reason | +|------------------------------+----------------------------------------------------------------------------------------------| +| [[./emacs-no-version-check.patch][emacs-no-version-check.patch]] | [[https://github.com/NixOS/nixpkgs/commit/35ccb9db3f4f0872f05d175cf53d0e1f87ff09ea][35ccb9d]] breaks my nix-doom-emacs install by preventing home-manager from building. This patches undoes this commit. |