lib: add fetchb4

This commit is contained in:
xenia 2024-07-03 23:53:56 -04:00
parent 517e0fe22d
commit 5d22a69173
4 changed files with 35 additions and 0 deletions

View File

@ -182,6 +182,19 @@ pkgs.fetchFromSteam {
} }
``` ```
### [`fetchb4`](./lib/fetchb4)
A fetcher that uses `b4` to download patchsets from <https://lore.kernel.org> so that they can be applied in `boot.kernelPatches`
Usage:
```nix
pkgs.fetchb4 {
msgid = "2024042069.1337-example@example";
hash = pkgs.lib.fakeHash;
}
```
### [`mkNginxServer`](./lib/dev-nginx) ### [`mkNginxServer`](./lib/dev-nginx)
creates a shell script that launches nginx in the foreground as the current user. the nginx is creates a shell script that launches nginx in the foreground as the current user. the nginx is

View File

@ -8,6 +8,7 @@
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
fetchFromSteam = prev.callPackage ./lib/fetchsteam {}; fetchFromSteam = prev.callPackage ./lib/fetchsteam {};
fetchb4 = prev.callPackage ./lib/fetchb4 {};
gitSource = prev.callPackage ./lib/git-source {}; gitSource = prev.callPackage ./lib/git-source {};

6
lib/fetchb4/builder.sh Normal file
View File

@ -0,0 +1,6 @@
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
source $stdenv/setup
echo "Downloading kernel patch $msgid into $out"
export HOME="$PWD"
b4 am -C -o- "$msgid" > "$out"

15
lib/fetchb4/default.nix Normal file
View File

@ -0,0 +1,15 @@
{ lib, stdenvNoCC, b4, git, cacert }:
{ msgid, hash }: stdenvNoCC.mkDerivation {
name = "patch-${msgid}";
builder = ./builder.sh;
inherit msgid;
nativeBuildInputs = [ b4 git cacert ];
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
outputHashMode = "recursive";
outputHash = hash;
preferLocalBuild = true;
}