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