I have been trying to upgrade my Nix packages for about 2 days now, but every time NixOS tries to compile bash (and kernel) locally

I checked https://hydra.nixos.org/job/nixos/release-26.05/nixpkgs.bash.x86_64-linux/all and looks like bash binaries are already built and ready to use, but for some reason on my system nixos-rebuild switch –upgrade-all tries to compile it locally.

Now that --upgrade-all has updated my channels, even running nixos-rebuild switch will attempt at compiling bash locally.

Why is nixos-rebuild not downloading the binaries?

Would you mind sharing your configuration (minus sensitive information)?

1 Like

Btw, you can undo the effect of --upgrade-all. Use nix-channel --list-generations to list previous channels generations, and you can use nix-channel --rollback to go to a previous one.

3 Likes

The short answer is because your local configuration contains changes that make it so that the binaries nix is supposed to create are not the same as the ones that are built by the distro infrastructure.

If this happens, nix will attempt to build them locally.

You can cause this any number of ways (overlays, changes to nixpkgs.config, weird channel/input choices) that are impossible to spot without you sharing your configuration, the commands you’re running, and maybe sudo nix-channel --list.

1 Like

Here’s the guts of my configuration.nix (I am slowly moving as much as possible to my home.nix file):

{ config, pkgs, ... }:

let
  unstable = import <unstable> {};
in {
  imports =
    [
      ./hardware-configuration.nix
    ];

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.kernelPackages = pkgs.linuxPackages_latest;

  networking.hostName = "nixos";
  networking.networkmanager.enable = true;

  security.rtkit.enable = true;

  time.timeZone = "Europe/Copenhagen";

  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  nix.settings.experimental-features = [ "nix-command" "flakes" ];

  xdg.portal = {
    enable = true;
  };

  services.displayManager.sddm = {
    enable = true;
    wayland.enable = true;
  };

  services.desktopManager.plasma6.enable = true;
  services.printing.enable = true;
  services.pulseaudio.enable = false;
  services.xserver.enable = true;

  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    jack.enable = true;
  };

  users.users."myusername" = {
    isNormalUser = true;
    description = "myusername";
    extraGroups = [ "networkmanager" "wheel"];
    shell = pkgs.fish;
  };

  programs.firefox.enable = true;
  programs.git.enable = true;
  programs.hyprland.enable = true;
  programs.starship.enable = true;
  programs.steam.enable = true;
  programs.zoxide.enable = true;

  programs.fish = {
    enable = true;

    vendor = {
      config.enable = true;
      completions.enable = true;
      functions.enable = true;
    };

    generateCompletions = true;
  };

  programs.direnv = {
    enable = true;
    nix-direnv.enable = true;
  };

  environment.systemPackages = with pkgs; [
    neovim
    nvd
    nil
    nixd
    nixfmt
    nix-tree
  ];

  system.stateVersion = "26.05";
}

I shared my configuration.

Plus:

$ sudo nix-channel --list
[sudo] password for ...:
nixos https://nixos.org/channels/nixos-26.05
unstable https://nixos.org/channels/nixos-unstable

My laptop is kind of old:

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 7.0.12, NixOS, 26.05 (Yarara), 26.05.1947.a0374025a863`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.34.7`
 - channels(root): `"nixos-26.05, unstable"`
 - nixpkgs: `/nix/store/rdqvmws9k0ia6h2v27csqmcs0pb3alrj-nixos-26.05/nixos`

Thanks. This helped me switch and activate my changes without upgrading the packages.

Maybe related? Nix refuses some packages from binary cache
Looks like there are some bugs with infra.

5 Likes

Oh, thanks for the hint, my laptop was levitating from fans, and I even build some python modules / pipewire etc. which is not modified at all.

Will wait it out.

1 Like