When to open a PR to update a package Nix expression? (.. and what is the recommended way to run the latest version of a package?)

For example, TreeSheets is released quite frequently (sometimes daily; see releases), the last update to its Nix expression was in January 2022, so an update would be timely, but what if there is another release tomorrow?


Also, I’ve been keeping it simple to run the latest versions by doing the following:

  1. Clone NIxpkgs
    or
    git fetch --all -p and rebase

  2. Update version, rev, and sha256 (which is not as straightforward as I remember)

  3. Run nix-shell -I nixpkgs=~/clones/nixpkgs/ -v -p treesheets

Is this the most common method when trying to run the latest versions and Nixpkgs is not up to date?

Personally I use overrideAttrs to override the src in my config, so I don’t need to have a local clone of nixpkgs that I maintain. I also tend to add such packages to systemPackages, I’ve not come across one where I both cared about the version and didn’t want it permanently installed.

Both are valid approaches, though, especially if you already maintain a downstream nixpkgs for other reasons.

As for update frequency, I think that’s a better topic for #dev than #learn :slight_smile:

My personal opinion is anything security related ASAP, everything else whenever you (read: the maintainer) see a need/desire for it or close to feature freeze for major NixOS releases, whichever comes first.

Daily updates would probably be more likely to annoy your users than actually help them.

2 Likes

Also, if you find you want a way to automate this, look into GitHub - berberman/nvfetcher: Generate nix sources expr for the latest version of packages

I don’t think it’s usable in nixpkgs, but if you maintain your versions downstream it’s a godsend.

1 Like

For simple packages, I just do:

cd nixpkgs
git checkout -b update-<pkg>

nix-update <pkg> --commit
# testing
nix-build -A <pkg>
./result/bin/<cmd> --help

# Create PR
git push <fork> <branch>
# open PR

Some packages will require more work, but packages which have decent release discipline should be minimal effort.

3 Likes