]> Git — Sourcephile - sourcephile-nix.git/blob - nixpkgs/patches.sh
losurdo: udhcpc: retry forever
[sourcephile-nix.git] / nixpkgs / patches.sh
1 #!/usr/bin/env bash
2 set -eux
3 githubToken=$(pass julm/github.com/token/nixpkgs-patches.sh)
4 {
5 echo '['
6 for pr in \
7 83904 \
8 93305_ \
9 93293_ \
10 93457_ \
11 93659 \
12 96655 \
13 97740 \
14 98455 \
15 98734 \
16 101071 \
17 104457 \
18 109643 \
19 ; do
20 PR=${pr%_}
21 test $PR = $pr || echo '/*'
22 # pkgs.fetchpatch tries to normalize the patch using filterdiff after downloading it
23 # https://github.com/NixOS/nixpkgs/issues/41401#issuecomment-394173658
24 nix=$(mktemp)
25 trap "rm $nix" EXIT
26 cat >"$nix" <<EOF
27 { pkgs ? import <nixpkgs> {} }:
28 pkgs.fetchpatch {
29 url = "https://github.com/NixOS/nixpkgs/pull/$PR.diff";
30 sha256 = "0000000000000000000000000000000000000000000000000000";
31 }
32 EOF
33 hash=$(nix -L build -f "$nix" |& sed -ne 's/^ *got: *//p')
34 test -n "$hash"
35 # Token generated on https://github.com/settings/tokens
36 info=$(curl -Ls -H "Authorization: token $githubToken" \
37 https://api.github.com/repos/NixOS/nixpkgs/pulls/$PR)
38 description=$(printf %s "$info" | jq --raw-output .title)
39 cat <<EOF
40 {$(test "$(printf %s "$info" | jq --raw-output .merged)" = false || echo " # merged")
41 meta.description = "$description";
42 url = "https://github.com/NixOS/nixpkgs/pull/$PR.diff";
43 sha256 = "$hash";
44 }
45 EOF
46 test $PR = $pr || echo '*/'
47 done
48 echo ']'
49 } >"${0%.sh}".nix
50