Can't install pgadmin4 from unstable

I’m trying to install pgadmin4 from unstable but I’m getting following error message:

error: attribute ‘pgadmin4’ missing

I do see postgres4 listed in the NixOS Package search under unstable.

And, I can see it got merged here: pgadmin4: init at 6.3 by gador · Pull Request #154764 · NixOS/nixpkgs · GitHub

Any idea what I’m missing here?

Thanks!

Likely, your default channel isn’t following unstable, use:

$ nix-shell -p nix-info --run "nix-info -m"

To show channel info

Thanks @jonringer here’s what I got:

 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.102, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.11.336297.47cd6702934, nixos-unstable"`
 - channels(): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Hi,

I’m the author of the mentioned PR. What exactly do you mean when you say “install postgres4”? Do you mean “pgadmin4”? There is no postgres4.

How do you try to install pgadmin4? Do you use nix on another OS, or NixOS?

If you use NixOS, I suggest you use the provided option: NixOS Search

This is from nixos-21.11. Your nixos-unstable channel is following stable.

Thanks @gador you are right, I corrected my typo.

I’ll try installing using the option after I migrate my nixos to unstable.

should be able to update the channel by doing:

sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
sudo nix-channel --update

@jonringer @gador I’ve been installing unstable packages using the following in my configuration.nix:

let 
  unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
in
{
...

That didn’t work for unstable.pgadmin4 though.

And, I’m not sure how I can enable a service from unstable using this approach. :frowning:

Then it seems to be the correct time to update your nixos-unstable channel. (sudo) nix-channel --update nixos-unstable.

@NobbZ Is it possible to run a service from unstable on a system that is built using stable?

I know how to install unstable packages (using import), but I can’t figure out how to enable unstable services.

There might be several options.

If you are lucky, the module is compatible and provides a package option, then you just need to set that.

If you are less lucky, the module is compatible but does not provide a package option, then you need to use an overlay to replace the correct package.

If you have really bad luck the module isn’t compatible at all, then you need to “replace” the module by disabling the old and importing the new. See NixOS 23.11 manual | Nix & NixOS

@gador do you have any suggestion here? I don’t see any package option. I’d love to get pgadmin4 on my system but I can’t migrate to unstable at this time. I’ve been using import to install unstable packages as needed.

I can try an overlay or disable/import but I’m still pretty new to NixOS so I’d have to learn how to make that happen.

No, there isn’t any package option.

Unfortunately, I never encountered an situation, where a module and package was introduced on a version, where I am using a different one. I think part of the problem is also that the module was introduced in unstable as well (and din’t exist before).

I am also wondering, why the usual route of installing the package from unstable doesn’t seem to work for you. I have been using pgadmin4 without the module for a while.

Maybe your version of unstable is too old? pgadmin4 was just recently added as a package…

1 Like

Thanks @gador based on your response now I tried installing by adding unstable.pgadmin4 in systemPackages . I removed pgadmin from services.

When I click on pgadmin icon, it tries to connect to local port 8888 but it seems nothing is listening on port 8888.

What am I missing?

I have no idea where that port comes from. pgadmin4 connects to localhost:5050.

I’d suggest you enter “pgadmin4” in the terminal and post the output. Please be aware that pgadmin4 requires the path “/var/lib/pgadmin” and “/var/log/pgadmin” to exist and be writable by the user, who runs pgadmin4.

I personally just created the folders and chowned the paths to the current user.

LOL I’m an idiot that was a leftover shortcut from when I was running it in Docker.

Your instructions helped and I was able to get it up and running using the package.

Thanks again for your help!

1 Like