I have installed signal-desktop
using home.nix, and it recently stopped working saying that there is a newer release that I must use. The installed version is 5.25.0.
The latest nixos package is version 5.31.1. I am on the stable nixos channel. How can I upgrade to the latest version. Running nix-channel --update
and home-manager switch
didn’t do it.
Is there a way to upgrade just that package. If I do, will I need to manually keep it up to date from now on?
Will switchting to the unstable channel solve my problem? If so, is that something that is easy to do?
What is the best approach?
You can switch to unstable, but that would switch your entire system to unstable. If you simply want a package from unstable, you can “pin nixpkgs”. Here’s an example:
let nixpkgsUnstable = import (builtins.fetchTarball {
# Descriptive name to make the store path easier to identify
name = "nixos-unstable-2018-09-12";
# Commit hash for nixos-unstable as of 2018-09-12
url = "https://github.com/nixos/nixpkgs/archive/ca2ba44cab47767c8127d1c8633e2b581644eb8f.tar.gz";
# Hash obtained using `nix-prefetch-url --unpack <url>`
sha256 = "1jg7g6cfpw8qvma0y19kwyp549k1qyf11a5sg6hvn6awvmkny47v";
}) {};
in ...
environment.systemPackages with pkgs; = [
...
nixpkgsUnstable.signal-desktop
...
];
Here’s some more information: FAQ/Pinning Nixpkgs - NixOS Wiki
1 Like
Thanks for the reply. Ah, pinning is what I was looking for.
I read that link you supplied, and found something similar here. This is what I did:
sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable
sudo nix-channel --update
I was then going to make these changes in configuration.nix:
# Allow unstable packages.
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: {
unstable = import <unstable> {
config = config.nixpkgs.config;
};
};
};
and:
environment.systemPackages = with pkgs; [
unstable.signal-desktop
];
But before editing configuration.nix as shown above, I ran sudo nixos-rebuild switch
, and it appeared to upgrade every package to unstable.
This is what I get when I run sudo nix-channel --list
:
nixos https://nixos.org/channels/nixos-21.11
unstable https://nixos.org/channels/nixpkgs-unstable
Did I just upgrade my whole system to unstable? What did I do wrong?
No, you didn’t switch everything to unstable. That would have required replacing your existing nixos channel with the unstable one. You simply updated your stable channel.
Ah. So performing the occasional sudo nixos-rebuild switch
and home-manager switch
doesn’t update my installed packages? If not, then what did I do to accomplish that?
Is it when I do a sudo nix-channel --update
that triggers updating of my packages?
It’s a little bit more nuanced.
Updating your channels allows nixos-rebuild to “see” the package updates. But it’s nixos-rebuild that actually performs the updates.
In other words, nixos-rebuild builds off the current snapshot of your channels, and updating the channels updates the snapshot.
It just occurred to me that you shouldn’t have to use unstable in order to use signal. If upstream demands a version that is on unstable, then that version needs to be cherry-picked unto the stable branch. That can be done with a pull request.
I’m not on my PC at the moment, so I’ll create the PR tomorrow.
Yeah, thanks. I did understand that.
And because I didn’t know how to upgrade packages, I assumed I needed to get the latest signal-desktop from unstable. Turned out it was on stable.
Which leads to my next question: How do I know when there are updated packages? Is there a command to check for updates?
I don’t know of a command to check for updates, but if one doesn’t exist it should be trivial to make since the info comes from the repo on Github.