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