Why is "nixos-rebuild switch --upgrade-all " rebuilding

Since updating my channels to nixos 25.05 nixos-rebuild allways rebuilds big packages taking close to 7 hours. I guess that it is rebuilding chrome, maybe for my vscode (my only packet from unstable). Everything works after this, but I want to avoid these builds like it was before to update to 25.05.

What packets are rebuild ?
How can I figure out what is the reason for the rebuild ?
Where can i find the logs for nixos-rebuild ?

Share your config and we might be able to help with specifics.
Generally anything that you override, reverse dependencies of packages in your overlays, as well as packages without an open source software license, will get built locally.

1 Like

I thought I can figure this out myself with some logfiles. But if you want to put in the time, thank you.

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:
let 
  nixpkgs-unstable = import <nixpkgs-unstable> { config = { allowUnfree=true;};};
in
{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration-pc.nix
      <home-manager/nixos>
    ];
  nixpkgs.overlays = [
    (
      self: super: {
        libbluray = super.libbluray.override {
          withAACS = true;
          withBDplus = true;
        };
      }
    )
  ];
  
  # Bootloader.
  boot.loader.efi = {
     canTouchEfiVariables = true;
     efiSysMountPoint = "/boot";
  };

  # boot.kernelPackages = pkgs.linuxPackages_6_6;
  boot.zfs = {
     # enabled =  true;
     extraPools =  ["zfspool"];
     devNodes = "/dev/disk/by-id";
     forceImportAll = false;
     requestEncryptionCredentials = true;
     passwordTimeout = 240;
  };
  boot.loader.grub = {
     devices = ["nodev"];
     efiSupport = true;
     enable = true;
     extraEntries = ''
         menuentry "Windows" {
           insmod part_gpt
           insmod fat
           insmod search_fs_uuid
           insmod chain
           search --fs-uuid --set=root B9BB-45FD
           chainloader /EFI/Microsoft/Boot/bootmgfw.efi
         }
     '';
  };
  boot.supportedFilesystems = ["ntfs3" "zfs"];
  nix.settings.experimental-features = [ "nix-command" "flakes" ];
  documentation.enable=true;
  documentation.dev.enable=true;
  documentation.doc.enable=true;
  documentation.man.enable=true;
  documentation.man.man-db.enable=true;
  documentation.nixos.includeAllModules=true;
  documentation.man.generateCaches=false; # true;

  networking.firewall.allowPing = true;
  networking.hostName = "homenixos"; # Define your hostname.
  networking.hostId = "";

  # Enable networking
  networking.networkmanager = {
    enable = true;
    unmanaged = (import ./systemd.network.nix).managed_devices;
  };

  systemd.network = (import ./systemd.network.nix).network_configuration;
  virtualisation.libvirtd.enable = true;
  
  systemd.services.zfs-mount.enable =  true;
  # Set your time zone.
  time.timeZone = "Europe/Berlin";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

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

  fonts.packages = [
     pkgs.nerd-fonts.fira-code
     pkgs.nerd-fonts.droid-sans-mono
     pkgs.nerd-fonts.hasklug
     pkgs.nerd-fonts.heavy-data
     pkgs.nerd-fonts.hurmit
     pkgs.nerd-fonts.hack
     pkgs.nerd-fonts.go-mono
     pkgs.nerd-fonts._0xproto
  ];
  # needed for enabling nvidia
  services.xserver.videoDrivers = [ "nvidia" ];
  services.xserver.displayManager.gdm = {
    enable = true;
    autoSuspend = false;
    banner = "Hello";
  };
  services.hypridle.enable = true;
  programs.hyprlock.enable = true;
  programs.hyprland = {
    enable = true;
    withUWSM = true;
    xwayland.enable = true;
  };
  programs.uwsm = {
    enable = true;
    waylandCompositors = {
      hyprland = {
        prettyName = "Hyprland";
        comment = "Hyprland compositor managed by UWSM";
        binPath = "/run/current-system/sw/bin/Hyprland";
      };
      # cosmic = {
      #   prettyName = "cosmic";
      #   comment = "Cosmic managed by UWSM";
      #   binPath = "/run/current-system/sw/bin/cosmic-session";
      # };
    };
  };
  programs.wireshark.enable = true;
  programs.virt-manager.enable = true;
  programs.firefox.enable = true;
  services.nixseparatedebuginfod.enable = true;
  services.pcscd.enable = true;
  hardware.graphics = {
    enable = true;
    enable32Bit = true;
  };


  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    open = true;
    nvidiaSettings = false;
    package = config.boot.kernelPackages.nvidiaPackages.stable;
  };
  services.printing.enable = false;

  services.pulseaudio.enable = false;
  security.rtkit.enable = true;
  security.polkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };

  users.mutableUsers = false;
  users.users.root.hashedPassword = "";
  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.tobias = {
    openssh.authorizedKeys.keys = [
      ""
    ];
    hashedPassword = "";
    isNormalUser = true;
    description = "Tobias";
    extraGroups = [ "networkmanager" "wheel" "wireshark" "libvirtd" ];
    packages = import ./shared/tobias-packages.nix pkgs; 
  };
  users.users.git = {
    isSystemUser = true;
    group = "git";
    home = "/persistent/repos";
    createHome = true;
    shell = "${pkgs.git}/bin/git-shell";
    openssh.authorizedKeys.keys = [
      ""
    ];
  };

  users.groups.git = {};
  
  home-manager.useGlobalPkgs = true;
  home-manager.users.tobias = { pkg, ... }:{
    home.stateVersion = "23.11";
    wayland.windowManager.hyprland= {
      enable=true;
      systemd.enable=false;
      xwayland.enable=true;
      settings = import ./user/hyprland.nix { 
        monitor = [ "DP-2,2560x1440@59.95100,0x00,1" "Unknown-1,disabled" ]; 
          env = [ 
            "LIBVA_DRIVER_NAME,nvidia"
            "GBM_BACKEND,nvidia-drm"
            "__GLX_VENDOR_LIBRARY_NAME,nvidia"
            "WLR_NO_HARDWARE_CURSORS,1"
        ];
      };
    };
    services.hyprpaper = import ./user/hyprpaper.nix;    
    programs.hyprlock = import ./user/hyprlock.nix;
    services.hypridle = import ./user/hypridle-pc.nix;
    programs.waybar= import ./user/waybar.nix;
    programs.bash = import ./user/bash.nix { 
      shellAliases = {
        sshadd = "ssh-add -D; ssh-add ~/.ssh/tobi_home ~/.ssh/tobi_home_git";
      };
    };
    programs.helix = import ./user/helix.nix;
    programs.alacritty = import ./user/alacritty.nix;
    programs.starship = import ./user/starship2.nix;
    programs.git = import ./user/git.nix;
    programs.yazi = import ./user/yazi.nix;
    programs.gpg = {
        enable = true;
        scdaemonSettings = {
            disable-ccid = true;
        };
    };
    home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ";
    home.file.".icons/whitesur".source = "${pkgs.whitesur-cursors}/share/icons/WhiteSur-cursors";
    home.file.".icons/numix".source = "${pkgs.numix-cursor-theme}/share/icons/Numix-Cursor";
  };
  home-manager.users.root = { pkg, ... }:{
    home.stateVersion = "23.11";
    programs.bash = import ./user/bash.nix { 
      shellAliases = {
        sshadd = "ssh-add -D; ssh-add  ~/.ssh/root_home_git";
      };
    };
    programs.helix = import ./user/helix.nix;
    programs.alacritty = import ./user/alacritty.nix;
    programs.starship = import ./user/starship.nix;
    programs.git = import ./user/git.nix;
    programs.yazi = import ./user/yazi.nix;
    programs.gpg = {
        enable = true;
        scdaemonSettings = {
            disable-ccid = true;
        };
    };
  };
  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  environment.variables = {
    EDITOR = "hx";
    VISUAL = "hx";
  };
  
  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = import ./shared/system-packages.nix { inherit pkgs nixpkgs-unstable; }; 
  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  programs.mtr.enable = true;
  programs.gnupg.agent = {
    enable = true;
    # enableSSHSupport = true;
  };
  programs.ssh = {
    startAgent = true;
  };
  # List services that you want to enable:
  services.gnome.gnome-keyring.enable = true;
  # Enable the OpenSSH daemon.
  services.openssh = {
    enable = true;
    settings.PasswordAuthentication = false;
    settings.KbdInteractiveAuthentication = false;
    extraConfig = ''
      Match user git
        AllowTcpForwarding no
        AllowAgentForwarding no
        PasswordAuthentication no
        PermitTTY no
        X11Forwarding no
    '';
  };
  # Open ports in the firewall.
  networking.firewall.allowedTCPPorts = [ 22 ];
  # networking.firewall.interfaces.br0.allowedTCPPorts = [ 8888 ];
  networking.firewall.trustedInterfaces = [ "br0" "br12" ];
  system.stateVersion = "23.11"; # Did you read the comment?

}

The content of environment.systemPackages:

{ pkgs , nixpkgs-unstable } : [
  # uninteresting 
  (nixpkgs-unstable.vscode-with-extensions.override  {
    vscodeExtensions = 
    nixpkgs-unstable.vscode-utils.extensionsFromVscodeMarketplace [
      {
        name = "copilot";
        publisher = "github";
        version = "1.322.0";
        sha256 = "0q4qbz6frkgrdm6d86hbmpf0431c2w6h1gh7an92993awi0iks9x";
      }
      {
        name = "copilot-chat";
        publisher = "github";
        version = "0.27.1";
        sha256 = "1j7c8zfbmqc13y92yyz18x28981vqpb3b434rfjq9h3qq0iwyz0x";
      }
      {
        name = "cmake-tools";
        publisher = "ms-vscode";
        version = "1.20.53";
        sha256 = "03ilm06kl37xnvsaj9am7cny08ljhaskfr1ncnd6jd57m4qlwcn8";
      }      
      {
        name = "vscode-pull-request-github";
        publisher = "github";
        version = "0.110.0";
        sha256 = "09xc0bfbb64865ayzm18ijmn3f2h2qh4527243v85lv602xgm05f";
      }
      {
        name = "rust-analyzer";
        publisher = "rust-lang";
        version = "0.3.2457";
        sha256 = "0ccdc6ccwmbgw3ld6w02hf2pj2hywvp3v1gp3dsi8pyb5kkf8gsm";
        arch = "linux-x64";
      }
    ];
  })
]

This is likely to be the cause. I’d recommend to only override the specific packages that you need to have AACS/BDplus support with the overriden libbluray.
ffmpeg depends on libbluray, so your overlay requires ffmpeg to be rebuilt, which in turn requires a lot of packages to be rebuilt.

2 Likes

Thank you, I will try this.
But why did this never happen for channel 24.11 ?

I don’t know, sorry. Maybe something now depends on ffmpeg that didn’t before, or you changed something else inadvertently when updating to 25.05.

1 Like

I was able to test this. I have manged to only overlay the vlc.

    (
      self: super: {
        vlc = super.vlc.override {
          libbluray = super.libbluray.override {
            withAACS = true;
            withBDplus = true;
          };
        };
      }
    )

So far it worked.