Errors while building system

Hi everyone I’m trying to switch my config to using flakes but I’m running into these errors when I run the command sudo nixos-rebuild switch --flake .

error: 1 dependencies of derivation '/nix/store/mxaqi6wnq38a0773sqvianx2wjc9jlgb-os-prober-1.83.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ys28iw1knrxzk8g5klvix1q0z21hz7gv-grub-config.xml.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xzfk4lzhb0v6qvwnc3s6zanrr13ps0qn-install-grub.sh.drv' failed to build
error: 1 dependencies of derivation '/nix/store/f9giykkyn67f3vsixdnvi61g33k910hr-nixos-system-nixos-25.05.20241227.634fd46.drv' failed to build

Here are my config files:

Configuration.nix

# 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
      ./nvidia.nix
    ];

  # Bootloader.
  #boot.loader.systemd-boot.enable = true;
  #boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.grub.enable = true;
  boot.loader.grub.devices = [ "nodev" ]; 
  boot.loader.grub.useOSProber = true;  # Use OS Prober to detect Windows
  boot.loader.grub.efiSupport = true;
  boot.loader.efi.canTouchEfiVariables = true;
  
  # Zen kernel
  #boot.kernelPackages = pkgs.linuxPackages_zen;

  # Ntfs support
  boot.supportedFilesystems = [ "ntfs" ];

  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;

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the GNOME Desktop Environment.
  #services.xserver.displayManager.gdm.enable = true;
  #services.xserver.desktopManager.gnome.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.
  hardware.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.ruvik = {
    isNormalUser = true;
    description = "Ruvik Victoriano";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    #  thunderbird
    ];
  };

  # Install firefox.
  #programs.firefox.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; [
  	vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  	ffmpeg-full
	toybox
  	ntfs3g
	kitty
	yazi
	firefox
	btop
	fish
	eza
	file 
	which 
	tree
	mpv
	zstd
	yt-dlp 
	networkmanagerapplet
	pulseaudio
	fzf
	gedit
	git
	yt-dlp
	mpv
	evince
	nautilus
	nwg-look
	hyprshade
	adwaita-icon-theme
	
	#Screenshotting
	hyprshot 
	wl-clipboard
	
	# Nvidia
	vaapiVdpau
	libvdpau
  	libvdpau-va-gl 
 	nvidia-vaapi-driver
 	vdpauinfo
	libva
        libva-utils	
	
	# GStreamer
        gst_all_1.gstreamer # Video/Audio data composition framework tools like "gst-inspect", "gst-launch" ...
        gst_all_1.gst-plugins-base # Common plugins like "filesrc" to combine within e.g. gst-launch
        gst_all_1.gst-plugins-good
        gst_all_1.gst-plugins-bad
        gst_all_1.gst-plugins-ugly
        gst_all_1.gst-libav # Plugins to reuse ffmpeg to play almost every video format
        gst_all_1.gst-vaapi # Support the Video Audio (Hardware) Acceleration API
        
        # Web Privacy	
	mullvad-browser
	protonvpn-gui
  	
  	# C and C++ development environment
	gcc 
   	clang 
    	gdb    # Debugger
    	cmake
	
	# Editor
	vscode-fhs
	
	lxqt.lxqt-policykit 
  ];
  
  # Enable the Flakes feature and the accompanying new nix command-line tool
  nix.settings.experimental-features = [ "nix-command" "flakes" ];
  
  services = { 
  displayManager = {
      defaultSession = "hyprland-uwsm";
      sddm = {
        enable = true;
        theme = "catppuccin-mocha";
        package = pkgs.kdePackages.sddm;
        wayland.enable = true;
      };
    };
  };
  
  services.gnome.gnome-keyring.enable = true;
  security.pam.services.sddm.enableGnomeKeyring = true;
  
  # Flatpak support
  services.flatpak.enable = true;
  
  fonts = {
    enableDefaultPackages = true;
    packages = with pkgs; [
      font-awesome
      noto-fonts
      corefonts
      nerd-fonts.hack
      nerd-fonts.jetbrains-mono
    ];
  };

  programs = {
    zsh.enable = true;
    hyprland = {
      enable = true;
      withUWSM = true;
      xwayland.enable = true;
    };
  };

  xdg.portal = {
    enable = true;
    extraPortals = [
      pkgs.xdg-desktop-portal-gtk
    ];
  };
  
  # zram
  zramSwap = {
	enable = true;
	priority = 100;
	memoryPercent = 100;
	swapDevices = 1;
    algorithm = "zstd";
    };

  # Cpu powersave
  boot.kernelParams = [ "amd_pstate=guided" ];
  powerManagement.enable = true;
  powerManagement.cpuFreqGovernor = "schedutil";

  # 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 = "24.11"; # Did you read the comment?

}

flake.nix

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

  outputs = inputs@{ nixpkgs, home-manager, ...}: {
    nixosConfigurations = {
      nixos = nixpkgs.lib.nixosSystem {
	system = "x86_64-linux";
        modules = [
          ./configuration.nix

	 home-manager.nixosModules.home-manager
	 {
	   home-manager.useGlobalPkgs = true;
	   home-manager.useUserPackages = true;
            home-manager.users.ruvik = import ./home-manager;
          }
        ];
      };
    };
  };
}

I’ve tried to run nix-collect-garbage and delete the paths manually from /nix/store/ but nothing changes. What can I do? Thx

Did you have systemd-boot setup before? Without seeing more of the error log, you might want to try sudo nixos-rebuild --install-bootloader boot --flake <path>. Otherwise, if you are trying this on a VM, you might need to add boot.loader.grub.efiInstallAsRemovable = true (but I believe the error would manifest in a different way if that was the issue).

You might want to run efibootmgr to see if there is anything unsuspected going on.

I’m getting a very similar error:

error: builder for '/nix/store/6gq1rkbzsdbdrdqp2i3w0ylx0x98znah-dmraid-1.0.0.rc16.drv' failed with exit code 2;
       last 25 log lines:
       > make -C tools
       > make[1]: Entering directory '/build/dmraid/1.0.0.rc16/tools'
       > gcc -MM -MF dmraid.d -I  -I. -I../include -I../lib -O2 -DDMRAID_NATIVE_LOG -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_TEST -DDMRAID_AUTOREGISTER -O2 -D_LARGEFILE64_SOURCE dmraid.c; \
       > gcc -c -I  -I. -I../include -I../lib -O2 -DDMRAID_NATIVE_LOG -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_TEST -DDMRAID_AUTOREGISTER -O2 -D_LARGEFILE64_SOURCE dmraid.c -o dmraid.o
       > gcc -MM -MF commands.d -I  -I. -I../include -I../lib -O2 -DDMRAID_NATIVE_LOG -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_TEST -DDMRAID_AUTOREGISTER -O2 -D_LARGEFILE64_SOURCE commands.c; \
       > gcc -c -I  -I. -I../include -I../lib -O2 -DDMRAID_NATIVE_LOG -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_TEST -DDMRAID_AUTOREGISTER -O2 -D_LARGEFILE64_SOURCE commands.c -o commands.o
       > gcc -MM -MF toollib.d -I  -I. -I../include -I../lib -O2 -DDMRAID_NATIVE_LOG -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_TEST -DDMRAID_AUTOREGISTER -O2 -D_LARGEFILE64_SOURCE toollib.c; \
       > gcc -c -I  -I. -I../include -I../lib -O2 -DDMRAID_NATIVE_LOG -DHAVE_GETOPTLONG -fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline -DDMRAID_TEST -DDMRAID_AUTOREGISTER -O2 -D_LARGEFILE64_SOURCE toollib.c -o toollib.o
       > gcc -o dmraid dmraid.o commands.o toollib.o -rdynamic -L../lib \
       >       -L/nix/store/75k5rywwbb24z7g463cixdh4qnxisjc0-dmraid-1.0.0.rc16/lib -ldmraid -ldevmapper -ldevmapper-event -ldmraid -ldevmapper -ldl
       > gcc -o dmevent_tool dmevent_tool.c -I  -I. -I../include -I../lib -rdynamic -L../lib \
       >       -L/nix/store/75k5rywwbb24z7g463cixdh4qnxisjc0-dmraid-1.0.0.rc16/lib -ldmraid -ldevmapper -ldevmapper-event -ldmraid -ldevmapper -ldl
       > dmevent_tool.c:126:8: error: return type defaults to 'int' [8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-Wimplicit-int-Wimplicit-int8;;]
       >   126 | static _process_opt(int opt, const char *cmd)
       >       |        ^~~~~~~~~~~~
       > dmevent_tool.c: In function '_process_opt':
       > dmevent_tool.c:151:25: error: 'return' with no value, in function returning non-void [8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-Wno-return-mismatch-Wreturn-mismatch8;;]
       >   151 |                         return;
       >       |                         ^~~~~~
       > dmevent_tool.c:126:8: note: declared here
       >   126 | static _process_opt(int opt, const char *cmd)
       >       |        ^~~~~~~~~~~~
       > make[1]: *** [Makefile:78: dmevent_tool] Error 1
       > make[1]: Leaving directory '/build/dmraid/1.0.0.rc16/tools'
       > make: *** [make.tmpl:115: tools] Error 2
       For full logs, run 'nix log /nix/store/6gq1rkbzsdbdrdqp2i3w0ylx0x98znah-dmraid-1.0.0.rc16.drv'.
error: 1 dependencies of derivation '/nix/store/mxaqi6wnq38a0773sqvianx2wjc9jlgb-os-prober-1.83.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9m8g0l9kf10d5553vzryxkvwlwjjddxg-grub-config.xml.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ywmcbmi5n6c4505ql6lw1lrcngs5aw2h-install-grub.sh.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ygnmd7sl5i9365bg293achjvxzhsc9pw-nixos-system-nixos-25.05.20241227.634fd46.drv' failed to build

looks like dmraid has a build error, the make output was included for me.

Build failure: dmraid · Issue #367926 · NixOS/nixpkgs · GitHub seems to be relevant, it was fixed and merged into master two days ago, unstable should get the fix soon.

1 Like

You’re right, my bad I didn’t copy that part also. That seems to be the problem

you could wait for the fix to make it into the unstable branch (you can check the status, which shows the last release, here: https://status.nixos.org/) or you could switch your flake.nix to the stable version.