Explain how to use nixpkgs-update for a dummy

Hi! For the past 2 hours I have been trying to run nixpkgs-update to update a package I maintain (Without having to wait for the ryanbot). However I cannot seems to make it work, and the documentation is quite parse on it. Could someone help me make it work?

Here’s the steps I have done:

  • Git cloned my fork of nixpkgs onto my disk.
  • Added nixpkgs-update + hub to my NixOS config
  • Added the upstream nixpkgs using git remote add upstream "https://github.com/NixOS/nixpkgs.git"
  • run export GITHUB_TOKEN=<token> which is a classic github token with the Repo and Gist permision given
  • run git fetch
  • run git fetch upstream
  • run git pull
  • Finally run my update command: nixpkgs-update update --pr --nixpkgs-review "alistral 0.6.9 0.6.10"

However I am asked for my github username and password, but those doesn’t work due to my 2factora authentication. As well as nixpkgs-review not running for some reason?

Successfully finished processing
skipping cache
[check][nixpkgs-review]
[check][nixpkgs-review] report.md does not exist
:x: nixpkgs-review failed
Username for 'https://github.com': RustyNova016
Password for 'https://RustyNova016@github.com': 
Username for 'https://github.com': RustyNova016
Password for 'https://RustyNova016@github.com': 
Username for 'https://github.com': RustyNova016
Password for 'https://RustyNova016@github.com': 
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'

[result] Failed to update alistral 0.6.9 -> 0.6.10

Am i missing something? I also didn’t manage to find any documentation on how to setup hub’s credentials either.

Install the gh cli (pkgs.gh) and run gh auth login. Then you should not get prompted for your “password” (github actually expects a token at that prompt, FYI. this is probably the issue you’re running into).

You can also do nix-shell ./maintainers/scripts/update.nix --argstr package "<pkgname>"

This will make the changes locally

Ok I have logged into my account using GH, and it stopped asking me for the password, however it prints the same errors…

[check][nixpkgs-review]
[check][nixpkgs-review] report.md does not exist
:x: nixpkgs-review failed
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'

[result] Failed to update alistral 0.6.9 -> 0.6.10

Can you reply with the .git/config of the clone and your global ~/.gitconfig/~/.config/git/config (with credentials scrubbed)?
You may also have a stale cached line in ~/.git-credentials.

Well I was kinda expecting to have auto PRs… Can simply update my hash myself instead.

.git/config:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = https://github.com/RustyNova016/nixpkgs.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "upstream"]
        url = https://github.com/NixOS/nixpkgs.git
        fetch = +refs/heads/*:refs/remotes/upstream/*

~/.gitconfig

[credential "https://github.com"]
        helper = 
        helper = !/nix/store/66h5dr9v94x04myh2kabx06rq9763jfc-gh-2.102.0/bin/.gh-wrapped auth git-credential
[credential "https://gist.github.com"]
        helper = 
        helper = !/nix/store/66h5dr9v94x04myh2kabx06rq9763jfc-gh-2.102.0/bin/.gh-wrapped auth git-credential

No ~/.config/git/config
No ~/.git-credentials

BTW my nixpkgs-update is on the latest commit, using the same flake.lock as the repository

Idea: unset the GITHUB_TOKEN env variable, then re-login to gh and try again. It may be interacting weirdly with gh auth login.

I did do export GITHUB_TOKEN= before gh auth login as it warned me that there was already a token there. Altough now I realize that it isn’t the same as unset GITHUB_TOKEN and it… Threw a new error…

> [!TIP]
> As a maintainer, if your package is located under `pkgs/by-name/*`, you can comment **`@NixOS/nixpkgs-merge-bot merge`** to automatically merge this update using the [`nixpkgs-merge-bot`](https://github.com/NixOS/nixpkgs/blob/698ba449ce89e79baec9488ce3cc26f2c751888b/ci/README.md#nixpkgs-merge-bot).
HTTPError (HttpExceptionRequest Request {
  host                 = "api.github.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("User-Agent","github.hs/0.28.0.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
  path                 = "/repos/nixos/nixpkgs/pulls"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
 (StatusCodeException (Response {responseStatus = Status {statusCode = 401, statusMessage = "Unauthorized"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Type","application/json; charset=utf-8"),("X-GitHub-Media-Type","github.v3; format=json"),("Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, X-GitHub-Edge-Region, Deprecation, Sunset"),("Access-Control-Allow-Origin","*"),("Strict-Transport-Security","max-age=31536000; includeSubdomains; preload"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("X-XSS-Protection","0"),("Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("Content-Security-Policy","default-src 'none'"),("Vary","Accept-Encoding, Accept, X-Requested-With"),("Server","github.com"),("Date","Sat, 10 Oct 2026 19:03:25 GMT"),("X-GitHub-Request-Id","D660:300327:C2F518C:1249CB0F:6ACA8BFD"),("x-github-edge-region","fra"),("connection","close")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose, responseOriginalRequest = Request {
  host                 = "api.github.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("User-Agent","github.hs/0.28.0.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
  path                 = "/repos/nixos/nixpkgs/pulls"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
}) "{\r\n  \"message\": \"Bad credentials\",\r\n  \"documentation_url\": \"https://docs.github.com/rest\",\r\n  \"status\": \"401\"\r\n}"))
[result] Failed to update alistral 0.6.9 -> 0.6.10

Bad credentials? Even tho I have logged in fine using GH?

Hmm. After making sure you have unset all GH_*/GITHUB_* env vars, try running gh auth logout and doing gh auth login again to make sure nothing from your previous invocations when GITHUB_TOKEN was set is saved anywhere.
If you still get an error, please paste the output of gh auth status.

There is no GH_*/GITHUB_* environement variables, and my gh auth status seems fine (Logged out and back in)

github.com
  ✓ Logged in to github.com account RustyNova016 (keyring)
  - Active account: true
  - Git operations protocol: https
  - Token: gho_************************************
  - Token scopes: 'gist', 'read:org', 'repo', 'workflow'

Currently reruning the command, will take a good 10 minutes

BTW I use Konsole as my terminal emulator. Not sure if it breaks things but better have all the info

Nope! Same error

> [!TIP]
> As a maintainer, if your package is located under `pkgs/by-name/*`, you can comment **`@NixOS/nixpkgs-merge-bot merge`** to automatically merge this update using the [`nixpkgs-merge-bot`](https://github.com/NixOS/nixpkgs/blob/44ca018af5cbbd3552d5d5a97c638e08cc950c92/ci/README.md#nixpkgs-merge-bot).
HTTPError (HttpExceptionRequest Request {
  host                 = "api.github.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("User-Agent","github.hs/0.28.0.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
  path                 = "/repos/nixos/nixpkgs/pulls"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
 (StatusCodeException (Response {responseStatus = Status {statusCode = 401, statusMessage = "Unauthorized"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Type","application/json; charset=utf-8"),("X-GitHub-Media-Type","github.v3; format=json"),("Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, X-GitHub-Edge-Region, Deprecation, Sunset"),("Access-Control-Allow-Origin","*"),("Strict-Transport-Security","max-age=31536000; includeSubdomains; preload"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("X-XSS-Protection","0"),("Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("Content-Security-Policy","default-src 'none'"),("Vary","Accept-Encoding, Accept, X-Requested-With"),("Server","github.com"),("Date","Sat, 10 Oct 2026 19:25:12 GMT"),("X-GitHub-Request-Id","81A8:397FAE:C792C0D:12AE6AEA:6ACA9118"),("x-github-edge-region","fra"),("connection","close")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose, responseOriginalRequest = Request {
  host                 = "api.github.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("User-Agent","github.hs/0.28.0.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
  path                 = "/repos/nixos/nixpkgs/pulls"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
}) "{\r\n  \"message\": \"Bad credentials\",\r\n  \"documentation_url\": \"https://docs.github.com/rest\",\r\n  \"status\": \"401\"\r\n}"))
[result] Failed to update alistral 0.6.9 -> 0.6.10


Looking at my nixpkgs fork it seems I indeed have the branch, but not the PR… Which is the main part I want to automatize the PR when I publish a new version of the app

Ahh I see. nixpkgs-update uses the old, basically abandoned, hub cli (which has been replaced with gh) and wants to get its token from there. Your export GITHUB_TOKEN=<token> must have gotten malformed or something, which is why you were getting the password error for Git operations, even after gh auth login (because it may have tried to use the same token).
After unsetting the env vars and doing a relogin, the token used by gh became a normal OAuth token, correctly formed. However, nixpkgs-update couldn’t get a token to preform the Github (not Git) operations needed to create the PR, due to trying to use hub.

Try doing export GITHUB_TOKEN=$(gh auth token) and then rerunning.

And it’s back to the first error…

[check][nixpkgs-review] report.md does not exist
:x: nixpkgs-review failed
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'
Received ExitFailure 128 when running
Raw command: /nix/store/apl2ibxqrxbbj6z79nfgv892999z1zyv-git-2.44.0/bin/git push --force --set-upstream origin auto-update/alistral
Standard error:

remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/RustyNova016/nixpkgs.git/'

[result] Failed to update alistral 0.6.9 -> 0.6.10

I’m pretty sure my original github token is correctly formed tho. I didn’t close the tab displying the token and it’s the same as the one used in my export command
I don’t mind using hub btw, just that I do not know how to generate that auth config file as the docs are so lacking

Oh, I forgot quotes. export GITHUB_TOKEN="$(gh auth token)". If that doesn’t work I don’t know.

It results to the same content. Can’t be that

But thanks anyways. If nobody else respond I’ll just do an issue in the repository to ask for advice and better docs

It looks like you used the HTTPS URL for cloning your fork instead of the SSH URL. I don’t think GitHub has accepted Git pushes to HTTPS URLs for a while now. If you run git remote set-url origin git@github.com:RustyNova016/nixpkgs.git, I think that will clear up this most recent error.

They still do accept HTTPS pushes! just not with your actual password. it needs an access token.