Why does this overlay not actually change the version?

    (self: super:

{
  logseq = super.logseq.overrideAttrs ( old: rec {
     version = "0.2.6";
     pname="logseq";
     src = super.fetchurl {

       url = "https://github.com/logseq/logseq/releases/download/0.2.6/logseq-linux-x64-0.2.6.AppImage";
       sha256 = "/tpegRGyGPviYpaSbWw7fH9ntvR7vUSD5rmwDMST5+Y=";
       name = "logseq-0.2.6.AppImage";
    };

     appimageContents = super.appimageTools.extract {
       name = "logseq-0.2.6";
       inherit src;
     };
  });
})

I add the overlay , i rebuild, it and it downloads something but the installed version remains the same.
I just don’t get it

1 Like
pkgs= import (fetchTarball https://github.com/nixos/nixpkgs/archive/nixos-21.05.tar.gz) {} 
pkgs.logseq.name
# "logseq-0.0.16"

overlay_logseq = (self: super:
{
  logseq = super.logseq.overrideAttrs ( old: rec { # rec
     version = "0.2.6";
     pname="logseq";
     src = super.fetchurl {
       url = "https://github.com/logseq/logseq/releases/download/${version}/${pname}-linux-x64-${version}.AppImage";
       sha256 = "/tpegRGyGPviYpaSbWw7fH9ntvR7vUSD5rmwDMST5+Y=";
       name = "${pname}-${version}.AppImage";
    };

     appimageContents = super.appimageTools.extract {
       name = "${pname}-${version}";
       inherit src;
     };
  });
}
)
pkgs= import (fetchTarball https://github.com/nixos/nixpkgs/archive/nixos-21.05.tar.gz) { overlays = [ overlay_logseq  ]; }
pkgs.logseq.name
# "logseq-0.2.6"

What is not working?

As I said, the installed version does not change. It says that it is logseq-0.2.6, that is what the logs show, that is what the folder in nix store is called, and yet, it doesn’t actually change the program. I launch it and i am stuck with 0.0.16.(Well actually 0.2.3 because i am using the overlay on unstable, but i did also try it on stable and got version 0.0.16)
This overlay is in home-manager. I can’t imagine that changes anything but :man_shrugging:

Just tried it in configuration.nix to make totally sure. Same problems there.

You are gonna have to show us how you are applying the overlay, since @igel pointed out that it works on his end as written, the error must be in how you are applying it to nixpkgs somehow.

I don’t think that is very likely, its the exact same as the other overlays i’m using without problems.

let
unstable = import <nixos-unstable> {
    overlays = [
(self: super:

        {
          logseq = super.logseq.overrideAttrs (old: rec {
     version = "0.2.6";
     pname="logseq";
     src = super.fetchurl {
       url = "https://github.com/logseq/logseq/releases/download/${version}/${pname}-linux-x64-${version}.AppImage";
       sha256 = "/tpegRGyGPviYpaSbWw7fH9ntvR7vUSD5rmwDMST5+Y=";
       name = "${pname}-${version}.AppImage";
    };

     appimageContents = super.appimageTools.extract {
       name = "${pname}-${version}";
       inherit src;
     };
          });
        })
			    ];

    config = { allowUnfree = true; };
  };
in{
  home.packages = with pkgs; [
#other packages
unstable.logseq
#other packages
]
}

Is there some way I can force a complete reinstall of logseq? I wonder if it using some cached package from a previous build.
And yes i know it should be in its own file or a variable but i am trying to eliminate steps as much as possible.

So I just copy pasted your expression into a nix file and imported it into the repl to see if the logseq version would show up properly and it did. It wouldn’t be cache issue since Nix changes the hash of a derivation when you change the package, so it wouldn’t even try to use the old one in place of the overlayed package. It looks like you are using home-manager from within NixOS, is that correct?

Perhaps you have installed logseq system wide in environment.systemPackages elsewhere in the configuration. Also, how are you determining that logseq is the wrong version after a system activation?

I have also tried it in my global configuration.nix, with the same result. I tried it using stable and unstable in both home.nix and configuration.nix
I am looking at the settings where it says the version I am running, it changes when moving from stable to unstable but it is always the version that defaultly comes with that channel.

Okay, i have just deleted all my old derivations and cleaned the garbage, restarted did that again. and then tried to install it.

no luck, same version

Yeah, after actually building it and checking the version as you say, I am seeing the same thing (in the settings). My guess at this point would be that the appimageContents portion needs some special magic to properly override, similar to how it is difficult to overlay a rust package without some gymnastics involved. The good news is, I just checked master and logseq is at the exact version you want, so maybe an alternative would be to just pull it from master.

Wouldn’t that require me to update my whole unstable version?

Not necessarily, I also checked unstable and it’s a few versions behind. It’s only on master so you could add another channel for it if you’d like. After looking at the package definition, I also noticed the installPhase references the appimageContents using a rec call. It’s possible that this is referencing the static value in nixpkgs, and not the updated value you are supplying. Maybe copying the installPhase into your overlay would solve it?

Update

Copying the installPhase from the original package does indeed solve the problem for me.

1 Like

…welp… looks like I’m an idiot.
Thanks for all your help. :slight_smile:

I wouldn’t say so, it’s kinda of an obscure issue and not at all obvious. Just glad we figured it out :laughing:

2 Likes