]> Git — Sourcephile - sourcephile-nix.git/blob - nixpkgs/patches.sh
coturn: quiet logs
[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 93629 \
13 96655 \
14 97740 \
15 98455 \
16 98734 \
17 101071 \
18 104457 \
19 106765 \
20 109643 \
21 ; do
22 PR=${pr%_}
23 test $PR = $pr || echo '/*'
24 # pkgs.fetchpatch tries to normalize the patch using filterdiff after downloading it
25 # https://github.com/NixOS/nixpkgs/issues/41401#issuecomment-394173658
26 nix=$(mktemp)
27 trap "rm $nix" EXIT
28 cat >"$nix" <<EOF
29 { pkgs ? import <nixpkgs> {} }:
30 pkgs.fetchpatch {
31 url = "https://github.com/NixOS/nixpkgs/pull/$PR.diff";
32 sha256 = "0000000000000000000000000000000000000000000000000000";
33 }
34 EOF
35 hash=$(nix -L build -f "$nix" |& sed -ne 's/^ *got: *//p')
36 test -n "$hash"
37 # Token generated on https://github.com/settings/tokens
38 info=$(curl -Ls -H "Authorization: token $githubToken" \
39 https://api.github.com/repos/NixOS/nixpkgs/pulls/$PR)
40 description=$(printf %s "$info" | jq --raw-output .title)
41 cat <<EOF
42 {$(test "$(printf %s "$info" | jq --raw-output .merged)" = false || echo " # merged")
43 meta.description = "$description";
44 url = "https://github.com/NixOS/nixpkgs/pull/$PR.diff";
45 sha256 = "$hash";
46 }
47 EOF
48 test $PR = $pr || echo '*/'
49 done
50 echo ']'
51 } >"${0%.sh}".nix
52