overrideAttrs for AppImage packages?

Greetings!

I’d like to know if there is some mechanism to update the attributes of an AppImage package in nixpkgs, something like overrideAttrs for packages built using mkDerivation.

Context: the current version of todoist-electron is broken on my machine due to being an old version, but downloading the AppImage and running with appimage-run works fine, so I wanted to override the version and the src attributes. There is a PR that should fix it, but knowing a workaround for a situation like this should be useful regardless. I thought about overriding, but version is not a function argument, and I also tried copying the default.nix file and importing it from my NixOS config, but could not manage to get it working.

Let me know if you need any more info. Thanks!

I’m not sure if there’s an equivalent for overrideAttrs that works on wrapAppImage / buildFHSEnv,
but the approach I usually take in this situation is to create a PR in nixpkgs with the fix, and then use the associated branch from my nixpkgs fork (github:kylesferrazza/nixpkgs/branchname) as a new input in my nixos config flake from which to pull just the fixed package. You can combine this with an overlay so that you only need to say “use todoist-electron from this branch” in one place without updating all your uses of pkgs.todoist-electron. Here’s an example from my configs of setting that up with mitmproxy from the nixpkgs master branch:

I can add arbitrary packages to that inherit (masterPkgs) ... ; list to have them pinned to their version from master.

Once the PR is merged, I remove that override and flake input and go back to using the (now fixed) package from nixpkgs. You can use the same strategy for someone else’s in-review PR, in this case using an input of github:pokon548/nixpkgs/todoist-update-script. It might also be a good idea to use a commit hash instead of a branch name from an untrusted repo, so that updates to the branch don’t get automatically pulled in on the next rebuild.

1 Like

Awesome, managed to get it working, thanks!

But this can be a bit annoying, I used a fork of nixpkgs of my own, and it required doing the change, committing, pushing, and updating the ref of the flake to the new commit (a few times because I messed up). I hoped it would be possible to edit the package file by copying it locally, and then reference it in the configuration, even if it required changing the package name to avoid clashing with the original. Regardless, I truly appreciate your help!

1 Like