I’m new to Nixos, and want to leave some feedback about the robustness of nixos-rebuild. Nixos-rebuild has failed on me in 4 different ways in succession. I hope my feedback will give some ideas to the maintainers on improving the general experience.
The first failure was on trying to switch --upgrade (through a planned system.autoUpgrade, i think) a 26.05 installation on an usb stick. For some reason, some linear algebra library started compiling itself, and running its tests. After over 10 minutes of running tests, it seemed to hang on the last test of the test suite, forcing me to abort. I tried to understand why it would be compiling the library, or run its tests. As far as I know the setting to compile packages if a cached version is missing is off by default?
The second failure was trying to switch --upgrade another 26.05 installation that i had installed next to a windows installation (successfully taking over the windows EFI system partition and adding a dual boot). I did read on the wiki that you would need to resize the EFI partition from the default windows size of 100MB, but decided to postpone that. But unfortunately, with 100 MB not even 1 extra bootloader upgrade will fit next to the running installation. The nixos-rebuild threw an error that it ran out of disk space on the EFI partition.
Now, back on the usb stick installation, I tried getting KDE’s partition-manager installed to give me some more room. The installation was taking a bit long so I left my computer running unattended. I had configured the desktop to go to sleep during inactivity, which seemed to have triggered, as I came back to a black screen. Waking from sleep worked flawlessly a few times before. However, this time the system was unresponsive to the mouse, CTRL + ALT + F3 etc, so I had to hard power off the system. I had made sure to give it plenty of time to respond, given that it was running on an USB stick.
After booting up the usb stick, I tried switching (without upgrading) again to get the partition manager installed. This time I got an error:
warning: could not re-exec in a newer version of nixos-rebuild, using current version
building the system configuration…
error: error parsing derivation ‘/nix/store/33j0crx8z2dh5j9k3niz4wyn8kswnhr3-dolphin-26.04.2.drv’: expected string ‘D’
Command ‘nix-build ‘<nixpkgs/nixos>’ --attr config.system.build.toplevel --no-out-link’ returned non-zero exit status 1.
This suggests to me some nix store package was left in a broken state due to being half downloaded, I am not sure.
All together I am puzzled by the lack of robustness of the nixos-rebuild experience. I guess I ran into several kinda hard to get right corner issues, but still. I’ll list the questions it raised for me.
Why is it possible for packages to compile, or even run tests, as part of an upgrade? (I recall finding some default setting that suggested it should not do that, maybe that’s simply not the default behavior)
Why does the nixos installer allow you to install on a EFI partition that is too small to support even 1 upgrade? Why does the bootloader package not check for sufficient space before copying new files onto it? I also got the impression that the default behavior of no GC being planned means everyone could eventually run out of space on the EFI partition, no matter how large it is?
Why do running nixos-rebuilds not keep the system from sleeping?
Why does the nixos store not keep track of whether a package might be left in an incomplete state because of FS issues, spurious reboots, etc.? I guess you would not want to run a full hash check of every package on every rebuild, but some flag that is set until a package is completely done downloading might be sufficient?
The error messages of nixos-rebuild are not informative about what state it left the system in. For failing upgrades, it should at least suggest to roll back the planned upgrade so it does not keep retrying installing failing packages. I am still unsure if it installed a part of the upgrades successfully or not. My experience with the last error was especially confusing, it suggests to me that a revision is not an immutable version of your package state.
Thank you for taking the time to read my feedback and making Nixos better for everyone.
For completeness I’ll include my configuration.nix, but I don’t think it includes anything that might have influenced anything.
# 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, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./firefox.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "nl_NL.UTF-8";
LC_IDENTIFICATION = "nl_NL.UTF-8";
LC_MEASUREMENT = "nl_NL.UTF-8";
LC_MONETARY = "nl_NL.UTF-8";
LC_NAME = "nl_NL.UTF-8";
LC_NUMERIC = "nl_NL.UTF-8";
LC_PAPER = "nl_NL.UTF-8";
LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "nl_NL.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = false;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users."foo" = {
isNormalUser = true;
description = "Foo";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
kdePackages.kate
kdePackages.kcalc
pkgs.git
pkgs.nil
pkgs.discord
];
};
programs.partition-manager.enable = true;
programs.firefox.enable = true;
programs.steam.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
];
system.autoUpgrade = {
enable = true;
allowReboot = true;
flags = [
"-L" # print build logs
];
dates = "02:00";
randomizedDelaySec = "45min";
};
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# 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;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "26.05"; # Did you read the comment?
}