]> Git — Sourcephile - julm/julm-nix.git/blob - nixpkgs/patches.sh
networkmanager: guard fix behind enable flag
[julm/julm-nix.git] / nixpkgs / patches.sh
1 #!/usr/bin/env bash
2 set -eux
3 set -o pipefail
4 githubToken=$(pass julm/github.com/token/nixpkgs-patches.sh)
5 {
6 echo '['
7 for pr in \
8 83904 \
9 93305_ \
10 93293_ \
11 93457_ \
12 93659 \
13 93629 \
14 94938 \
15 96655 \
16 97740 \
17 98455 \
18 98734 \
19 101071 \
20 104457 \
21 104460 \
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 build -f "$nix" |& sed -ne 's/^ *got: *//p')
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