Nix build errors out Nixos unstable

I’m trying to do a rebuild switch, I haven’t changed my config.nix after last time it worked.
Now I got this:

npacking channels…
building Nix…
building the system configuration…
error:
… while calling the ‘head’ builtin

     at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:820:11:

      819|         || pred here (elemAt values 1) (head values) then
      820|           head values
         |           ^
      821|         else

   … while evaluating the attribute 'value'

     at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:768:9:

      767|     in warnDeprecation opt //
      768|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
         |         ^
      769|         inherit (res.defsFinal') highestPrio;

   (stack trace truncated; use '--show-trace' to show the full trace)

   error: The type `types.string` is deprecated. See https://github.com/NixOS/nixpkgs/pull/66346 for better alternative types.

my configuration.nix is:

type or paste code here
# 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
    <home-manager/nixos>
    ];
    nixpkgs.config.allowUnfree = true;
  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.initrd.kernelModules = [ "amdgpu" ];
 boot.initrd.systemd.enable = true; 
  boot.kernelParams = ["quiet"];
  boot.plymouth.enable = true;
    boot.plymouth.theme="breeze";

  services.fstrim.enable = true;

  # networking.hostName = "nixos"; # Define your hostname.
  # Pick only one of the below networking options.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
   networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.
zramSwap = {
    enable = true;
    algorithm = "zstd";
  };

  # Set your time zone.
   time.timeZone = "Europe/Amsterdam";

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Select internationalisation properties.
   i18n.defaultLocale = "nl_NL.UTF-8";
   console = {
     font = "Lat2-Terminus16";
    keyMap = "us";
    # useXkbConfig = true; # use xkbOptions in tty.
   };

  # Enable the X11 windowing system.
  services.xserver.enable = true;
hardware.opengl.driSupport = true;
# For 32 bit applications
hardware.opengl.extraPackages = with pkgs; [
  rocm-opencl-icd
  rocm-opencl-runtime
];
hardware.opengl.driSupport32Bit = true;
  # Enable the Desktop Environment.
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;
  services.xserver.windowManager.dk.enable =true;
  services.dbus.packages = with pkgs; [ gnome2.GConf ];


  # Configure keymap in X11
   services.xserver.layout = "us";
   services.xserver.xkbOptions = "eurosign:e,caps:escape";

  # Enable CUPS to print documents.
  # services.printing.enable = true;

  # Enable sound.
   sound.enable = true;
   hardware.pulseaudio.enable = false;
   services.pipewire = {
  enable = true;
  alsa.enable = true;
  alsa.support32Bit = true;
  pulse.enable = true;
};

  hardware.bluetooth.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.simon = {
     isNormalUser = true;
      description  = "Simon de Waal";
     extraGroups = [ "wheel" "libvirtd" ]; # Enable ‘sudo’ for the user.
     packages = with pkgs; [
     ];
   };
  # List packages installed in system profile. To search, run:
  # $ nix search wget
   environment.systemPackages = with pkgs; [
     libsForQt5.kcodecs
     libsForQt5.phonon-backend-vlc
#Kodi 

(pkgs.kodi.passthru.withPackages (kodiPkgs: with kodiPkgs; [
  netflix
  vfs-sftp
  inputstreamhelper
  inputstream-adaptive
  youtube
	]))
  
      e2fsprogs
      btrfs-progs
  #diverse pakketen
  python3
   xdg-user-dirs
  teams
   vim_configurable # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
     git  
    vlc 
    spotify
   libreoffice-fresh
   neofetch
   sxhkd
   polybar
   picom
   feh
   virt-manager
  _86Box
  glxinfo
  google-chrome
  kitty
  wl-clipboard
  mako
  dunst
  swww
  wofi
 openmsx
  microsoft-edge-dev
 gettext
 libsForQt5.yakuake
 networkmanagerapplet
 exa
 nodePackages_latest.node-gyp
 pkgs.rPackages.rnpn
sass 
#DKWM
 dk
 rofi
#Gnome extentions
gnomeExtensions.appindicator
gnomeExtensions.pop-shell
gnomeExtensions.material-you-color-theming
gnomeExtensions.user-themes
gnomeExtensions.blur-my-shell
gnomeExtensions.dash-to-panel
gnomeExtensions.burn-my-windows
guake
gnome.gnome-tweaks
# waybar
(pkgs.waybar.overrideAttrs (oldAttrs: {
    mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
  })
)
];

#fonts
fonts.packages = with pkgs; [
  noto-fonts
  noto-fonts-cjk
  noto-fonts-emoji
  liberation_ttf
  fira-code
  fira-code-symbols
  mplus-outline-fonts.githubRelease
  dina-font
  proggyfonts
  corefonts
  nerdfonts
  vistafonts
];
#Virtualisatie
programs.dconf.enable = true;
virtualisation.libvirtd.enable = true;

#Steam
 programs.steam.enable =true;
#Fix Qt apps
  environment.variables = {
    "QT_STYLE_OVERRIDE" = pkgs.lib.mkForce "adwaita-dark";
  };

#Hyprland 
#xdg.portal.enable =true;

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

# programs.hyprland.enable = true;
#Home manager
home-manager.users.simon = { pkgs, ... }: {
 home.stateVersion = "23.11";
nixpkgs.config.allowUnfree = true;
 home.packages = [ 
 pkgs.helix
 pkgs.tree

   ];
 programs.obs-studio = {
    enable = true;
    plugins = with pkgs.obs-studio-plugins; [
   obs-backgroundremoval
   obs-vaapi  
    ];
  }; 
programs.vscode = {
  enable = true;
  extensions = with pkgs.vscode-extensions; [
    dracula-theme.theme-dracula
    vscodevim.vim
jnoortheen.nix-ide
bbenoist.nix
    yzhang.markdown-all-in-one
  ];
};
};

#Bashrc
programs.bash.interactiveShellInit ="neofetch" ;

 #autoupdater
 system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = false;
#Auto garbagecollector
  nix.gc = {
        automatic = true;
      dates = "daily";
      options = "--delete-older-than 3d";
    };
#auto optimise Nix store
 nix.settings.auto-optimise-store = true;
 
 #aliassen

 environment.shellAliases ={
  #ls = "ls -la";
  sysupgr = "sudo nixos-rebuild boot --upgrade";
  sysswitch = "sudo nixos-rebuild switch --upgrade";  
  sysconfig = "sudo vim /etc/nixos/configuration.nix";
  sysclean  = "sudo nix-collect-garbage -d";
  listgen = "sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";

};

#Vim config 
 environment.etc."vimrc".text = ''
    syntax on
    set number
    colorscheme elflord
  '';

# 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;

  # Copy the NixOS configuration file and link it from the resulting system
  # (/run/current-system/configuration.nix). This is useful in case you
  # accidentally delete configuration.nix.
  # system.copySystemConfiguration = true;

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

}```

Can you put your configuration.nix in a code block? It’s hard to read like this.

I have the same issue on NixOS unstable; i encountered this 2-3 days ago. It seems to be related to pull [#66346](.
I do not think it’s a configuration issue. It seems to be an issue on NixOS’s side. I hope they fix it soon (if it’s a NixOS-side issue that is).

Indeed, @zstg is right, caused by this PR a few days ago: treewide: stop using types.string by jian-lin · Pull Request #247937 · NixOS/nixpkgs · GitHub

It has already been reverted, should no longer be a problem in a few days. In the mean time, stick to an older version.

1 Like

@TLATER I do not think you reference the right PR.

types.string is made to be an error in lib.types.string: Deprecation error instead of warning by infinisil · Pull Request #247848 · NixOS/nixpkgs · GitHub. This can be seen in the commit message or the PR description of my PR treewide: stop using types.string by jian-lin · Pull Request #247937 · NixOS/nixpkgs · GitHub. My PR, like the title says, just removes usages of types.string remaining in Nixpkgs, which does not cause any error and is not reverted.

To make it clear, my PR is the fix for the error OP gets. It has reached nixos-unstable branch. I am not familiar with channels (I use flake), but I guess this error will disappear if OP updates his channel.

2 Likes

I’ve discovered it’s a home manager issue. After some debugging by firstly apply a vary basic configuration.nix to my system without home manager it has build succefully. then I added my home manager part line by line and I discovered

imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    <home-manager/nixos>
    ];

was not a problem.

Problems came with
Home manager


home-manager.users.simon = { pkgs, ... }: {
 home.stateVersion = "23.11";
nixpkgs.config.allowUnfree = true;
 home.packages = [ 
 pkgs.helix
 pkgs.tree
   ];
etc..

I removed all home manger related stuff and I installed home manager is a standalone program and got the same error.

Then I removed the home manager channel and stand alone program.


sudo home-manger --uninstall
sudo nix-channel --remove home-manager

Then I did a


nix-channel --update

and
added the home manager channel again


sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix
nix-channel --update

re applied the configuration.nix from above again with


sudo nixos-rebuid switch  --upgrade

now it works, but with this output:


unpacking channels...
building Nix...
building the system configuration...
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: The option `fonts.fonts' defined in `/etc/nixos/configuration.nix' has been renamed to `fonts.packages'.
activating the configuration...
setting up /etc...
reloading user units for simon...
setting up tmpfiles
the following new units were started: libvirtd.service

Ah, in that case you were using an outdated version of home-manager. Likely stuck on an old stable version. If you use nixpkgs unstable, you should use the unstable branch of home-manager as well. Occasionally breakage may still occur, but it will be shorter lived. If you don’t want any of these issues, use the same stable version for both.

These kinds of problems are due to home-manager relying on some NixOS semi-internals, and they currently live in separate repositories, with no good way to match commits. This may be fixed in the future either by a more aggressive adoption of flakes or this discussion: Duplication home-manager and nixos modules - #9 by AndersonTorres

2 Likes

Thank you, I am on the unstable channel (both nixos itself and home-manager), and I still get this issue.

Have you used sudo nix-channel --update, and made sure you are using unstable with your root channels, not your user channels?

Yes, I’d tried that as well. I was using the unstable channels of home-manager and nixos. I’ve moved to Arch for now though.