Question regarding package updates

I recently had a question about kernel updates on NixOS which was answered here.

As I am still new to NixOS am still a bit confused when it comes to package updates. I have configured my system to use the “nixos-unstable” channel.

When I upgrade I followed the instructions listed here. So by running the following command.
nixos-rebuild switch --upgrade

When I take for example the fastfetch package on my system to see which version I have I see the following.

fastfetch --version
fastfetch 2.14.0 (x86_64)

However when I check search.nixos.org and look up fastfetch version I see a different version listed for the unstable channel fastfetch: 2.15.0. But that version is not installed on my system. What am I still missing here when it comes to updates?

I don’t know if this is useful information but it seems like it. I’m using a Flake that looks like this, based on the example I saw in the home manage manual.


{
  description = "NixOS flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, nixpkgs, home-manager, ... }@inputs: {
    nixosConfigurations.lilith = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        # Import the previous configuration.nix we used,
        # so the old configuration file still takes effect
        ./configuration.nix
        home-manager.nixosModules.home-manager
        {
            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.cphusion = import ./user/cphusion-home.nix;
        }
      ];
    };
  };
}

I figured out my problem because I am using a flake there is an extra step. I have to update my flake.lock file by running.
# nix flake update

After which I can run the upgrade.
# nixos-rebuild switch --upgrade

Now when I check fastfetch, I have the same version installed as listed on search.nixos.org for the unstable channel.

fastfetch --version
fastfetch 2.15.0 (x86_64)

So my problem and confusion are resolved.

The --upgrade is only confusing you. It’s pulling a channel (nix-channel), but you’re using flake instead of the channel.

1 Like

@vcunat Thanks for your reply! So is my conclusion correct, that I first have to run “nix flake update” and then " nixos-rebuild switch --upgrade" or is there a better way of doing it?

Or is all I need to do run “nix flake update” and then run “nixos-rebuild switch” since everything is updated through the flake?

You could drop the --upgrade. You don’t need it for flake stuff.

2 Likes

I appreciate your help and explanation! Thanks for your help!

1 Like

@anon39437090 SYN :vulcan_salute:

I’m very new to NixOS, too; I have been using it for less than two months! Because I had some free time, I’ve been learning Nix and NixOS nonstop; I can’t get enough of them.

I remember reading somewhere a reply someone left to a post about configuration management tools (e.g., Ansible, Chef, Salt) and how they stitched them to other toolsets to achieve granular management of their infrastructure. This person replied along the lines, “So, you’re achieving less than what Nix is capable of doing, with a lot more of effort and tools.” – nailed it. Nix, and by extension NixOS, are sweet, the good stuff :smile:

So, check below these links that hopefully will help you get started as fast as possible:

Just to name a few to get you started, there are tons of great content about Nix and NixOS on YT.

It would help if you also spend some time at:

https://nixcloud.io/tour/

and

Last, my ongoing (and forever WIP, I’m realizing) flake where I’m applying all the stuff I’m learning:

One interesting thing about my flake is that I’m using the nixos-24.05 release channel for the “mission critical” stuff–that is all I consider the “infrastructure” part of my systems (system utilities, configurations, graphical stack, DE/WM stuff, and so on) while using nixos-unstable for everything else.

4 Likes

I have been using NixOS for 8 days now. I ran it in a vm for a day and the next day I reinstalled my desktop with NixOS :slight_smile: I am very happy with it!

I already have some of the links you shared bookmarked and Youtubers but will have a look at the ones that I didn’t have yet.

I run NixOS on my desktop so I’m not sure how deep I will go into it but it would be cool to learn how to write some of my own modules so that looks useful.

I have already put my configuration in my Git repo and made it modular in case I want to do anything with it.

I’ll just share the links I have that I found useful when it comes to information about NixOS, for anyone new to NixOS that comes across this topic.

https://nixos.org/manual/nixos/stable
https://nlewo.github.io/nixos-manual-sphinx/index.html
https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix
https://nix.dev/manual/nix/2.18/command-ref/nix-env
https://nix-community.github.io/home-manager

https://wiki.nixos.org/wiki/NixOS_Wiki
https://search.nixos.org/packages
https://search.nixos.org/options
https://home-manager-options.extranix.com

3 Likes

Recommending people join a discord server on discourse.nixos.org is a Nix anti-pattern. Please stop.

1 Like

It’s linked on Community | Nix & NixOS and some people prefer realtime chat over forum style. But I do think it’s a shame to put help info behind a closed door.

2 Likes

It’s linked on Community | Nix & NixOS and some people prefer realtime chat over forum style. But I do think it’s a shame to put help info behind a closed door.

An important detail you left out is that this Discrod is listed as an UNOFFICIAL platform. That fact in of itself seems to be a clear enough warning why not to use it for communications.

Overall as of recent times there has been a lot of migration in open-source projects to Discord, not just in the NixOS community. Why do I feel this should stop?

First, we need to see this for what it really is.

Convenience? Well that is relative. To me, a non-discord user, it presents nothing but inconveniences. Sure, I’ll give some that Discord is convenient for real-time communication, but that is a weak basis for it’s use. IRC is convenient. Forums are convenient. Email is convenient.

The major problem is that Discord is proprietary, and inherently lacks the archival capabilities and searchability that I see as essential for maintaining a transparent and accessible record of project development, collective problem solving, and the list goes on and on. I see this shift from traditional internet platforms like, IRC, BBS, mailing lists, forums, etc; to corporate, centralized ephemeral chat environments as an existential threat to the survival of the free and open Internet as we know it. The pattern creates a fragmented knowledge base, where crucial decisions, bug reports, and development discussions are easily lost or obscured in vast message histories that are not owned or maintained by the public. The total proprietary nature of Discord means that critical project data is locked into a platform that could change its policies, terms, or even shut down, jeopardizing the continuity of these discussions. Using Discord goes against the open, accessible nature of open-source projects.

I can not endorse relying on Discord for project discourse in any way. I only see it as representing an anti-pattern, compromising the sustainability, transparency, and collaborative spirit essential to the success and health of NixOS.

Okay, that’s my soap-box. Thanks for coming to my TED talk.

Buhbye.

2 Likes