Skip to content

Instantly share code, notes, and snippets.

@lorenzleutgeb
Last active July 9, 2024 14:13
Show Gist options
  • Save lorenzleutgeb/239214f1d60b1cf8c79e7b0dc0483deb to your computer and use it in GitHub Desktop.
Save lorenzleutgeb/239214f1d60b1cf8c79e7b0dc0483deb to your computer and use it in GitHub Desktop.
Nixpkgs Committer Progress
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p bash gh
set -eu
# See <https://gist.github.com/lorenzleutgeb/239214f1d60b1cf8c79e7b0dc0483deb>.
# Will exit non-zero if not logged in.
gh auth status
if [ $# == 1 ]
then
# Pass GitHub login name as commandline argument.
LOGIN=$1
else
# Default to currently logged in user.
LOGIN=$(gh api user --jq .login)
fi
BASE="gh pr list --repo NixOS/nixpkgs --json id --jq length --limit 500"
MERGED=$($BASE --author "$LOGIN" --state merged)
REVIEWED=$($BASE --search "reviewed-by:$LOGIN -author:$LOGIN" --state all)
cat << EOM
――――――――――
- [$MERGED PRs merged](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Amerged+author%3A$LOGIN)
- [$REVIEWED PRs reviewed](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+reviewed-by%3A$LOGIN+-author%3A$LOGIN)
EOM
@lorenzleutgeb
Copy link
Author

lorenzleutgeb commented Oct 17, 2023

@Artturin thanks. You're spot on. I usually use nix shell with Flakes, and did not realize that I still had this outdated channel. Fixed.

@drupol
Copy link

drupol commented Oct 19, 2023

Once you use the lines advised by @Artturin, use the repl as such: nix repl "/etc/nix/inputs/nixpkgs"

Thanks for that @Artturin, I'm now using it :) That's very handy.

@Artturin
Copy link

Artturin commented Oct 19, 2023

Once you use the lines advised by @Artturin, use the repl as such: nix repl "/etc/nix/inputs/nixpkgs"

No need to use that since NIX_PATH is set
nix repl --file "<nixpkgs>" works

If you want to use the flake then pin the registry too

  nix.registry = {
    nixpkgs.to = {
      type = "path";
      path = pkgs.path;
    };
  };

nix repl nixpkgs (flake repl is currently a experimental feature)

@drupol
Copy link

drupol commented Oct 19, 2023

That doesn't work here...

❯ nix repl --file "<nixpkgs>" 
Welcome to Nix 2.17.0. Type :? for help.

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

@Artturin
Copy link

That doesn't work here...

❯ nix repl --file "<nixpkgs>" 
Welcome to Nix 2.17.0. Type :? for help.

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

Did you relogin so the env var gets updated

@drupol
Copy link

drupol commented Oct 19, 2023

Nope... trying.

@drupol
Copy link

drupol commented Oct 19, 2023

It works! Thanks once again !

@imincik
Copy link

imincik commented Nov 22, 2023

Great work @lorenzleutgeb ! Works very nicely for me !

@afh
Copy link

afh commented May 1, 2024

@lorenzleutgeb Maybe add a link this gist as a reference to the source in the script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment