Problem with nixpkgs.hostplatform or system

Hello everyone,

im new to NixOs (3rd day today) and

i tried to add a nix file, after taking it out again and entering the rebuild command

it ends in this error code:

```

error:… while calling the ‘seq’ builtinat /nix/store/nv0f6mcdixfwhjqxnnrk3iwfvkgbrxjl-source/lib/modules.nix:361:18:360| options = checked options;361| config = checked (removeAttrs config [ “_module” ]);| ^362| _module = checked (config._module);

… while evaluating a branch condition
at /nix/store/nv0f6mcdixfwhjqxnnrk3iwfvkgbrxjl-source/lib/modules.nix:297:9:
296| checkUnmatched =
297| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != then
| ^
298| let

… while evaluating the module argument `pkgs’ in “/nix/store/nv0f6mcdixfwhjqxnnrk3iwfvkgbrxjl-source/nixos/modules/services/hardware/bluetooth.nix”:

… noting that argument pkgs is not externally provided, so querying _module.args instead, requiring config

… while evaluating the option `nixpkgs.localSystem’:

… while evaluating the option `nixpkgs.system’:

(stack trace truncated; use ‘–show-trace’ to show the full, detailed trace)

error: Neither nixpkgs.hostPlatform nor the legacy option nixpkgs.system has been set.
You can set nixpkgs.hostPlatform in hardware-configuration.nix by re-running
a recent version of nixos-generate-config.
The option nixpkgs.system is still fully supported for NixOS 22.05 interoperability,
but will be deprecated in the future, so we recommend to set nixpkgs.hostPlatform.

Command ‘nix --extra-experimental-features ‘nix-command flakes’ build --print-out-paths ‘/etc/nixos#nixosConfigurations.“nixos”.config.system.build.nixos-rebuild’ --no-link’ returned non-zero exit status 1.

```

i tried this solution to add my channel again : How to Fix 'nixpkgs' Not Found in Nix Search Path After Installing with sh — w3tutorials.net with solution four, number five didnt work because i cant write in the nix.nofig.

Channel ist stable 25.05, i can update but the error from above is still there when i enter the rebuild command.

here is my 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, lib, … }:

with lib;

{imports =[ # Include the results of the hardware scan.#./fuzzel.nix

./steam.nix

#./flatpak.nix#./vicinae.nix];

Bootloader.

boot = {loader = {systemd-boot.enable = true;efi.canTouchEfiVariables = true;systemd-boot.configurationLimit = 10; # Show up to 10 generations};

Use latest kernel.

kernelPackages = pkgs.linuxPackages_latest;kernelParams = [“amdgpu.dc=1”“amd_iommu=on”“acpi_osi=Linux”];kernelModules = [“kvm-amd”“amdgpu”“tpm_cbr”];extraModprobeConfig = “options amdgpu ppfeaturemask=0xffffffff\n\n”;bootspec = {enableValidation = 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/Berlin”;

Select internationalisation properties.

i18n.defaultLocale = “de_DE.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

fonts = {enableDefaultPackages = true;packages = with pkgs; [corefontsatkinson-hyperlegiblegeist-fontnerd-fonts.fira-codenerd-fonts.geist-monosource-code-pro];};

Enable the X11 windowing system.

You can disable this if you’re only using the Wayland session.

services.xserver.enable = true;

services.xserver.videoDrivers = [ “amdgpu” ];

Enable the KDE Plasma Desktop Environment.

services.displayManager.sddm.enable = true;services.desktopManager.plasma6.enable = true;

Configure keymap in X11

services.xserver.xkb = {layout = “de”;variant = “deadacute”;};

Configure console keymap

console.keyMap = “de”;

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;wireplumber.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;

};

Hardware Configuration #Steam #Controller #OpenGL #fwupd #Bluetooth

hardware = {graphics = {enable = true;enable32Bit = true;extraPackages = with pkgs; [rocmPackages.clr.icd # OpenCLlibva # VA-API];extraPackages32 = ;};amdgpu = {initrd.enable = true;opencl.enable = true;overdrive.enable = true;};steam-hardware.enable = true;#xone.enable = true;#xpadneo.enable = true;cpu.amd.updateMicrocode = true;

bluetooth = {enable = true;powerOnBoot = true;settings = {General = {

Shows battery charge of connected devices on supported

Bluetooth adapters. Defaults to ‘false’.

Experimental = true;

When enabled other devices can connect faster to us, however

the tradeoff is increased power consumption. Defaults to

‘false’.

FastConnectable = true;};Policy = {

Enable all controllers when they are found. This includes

adapters present on start as well as adapters that are plugged

in later on. Defaults to ‘true’.

AutoEnable = true;};};};};hardware.enableAllFirmware = 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.xenomorph = {isNormalUser = true;description = "Thorsten ";extraGroups = [ “networkmanager”“wheel”“audio”“gamemode”“cpugovctl”“sysctlgroup”“libvirtd”“kvm”“input”“plugdev”“tss”“immich”];packages = with pkgs; [kdePackages.katethunderbird];};

Install openrgb

services.hardware.openrgb.enable = true;

Gui BluetoothManager

services.blueman.enable = true;

List packages installed in system profile. To search, run:

#$ nix search wgetenvironment.systemPackages = with pkgs; [

vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.

pkgs.vimPlugins.clever-f-vim

Terminal

wgetfastfetchkittyninjacmakegnumakecurlgittree

zsh

zshoh-my-zshzsh-autocompletezsh-autosuggestionszsh-fast-syntax-highlightingzsh-syntax-highlighting

Multimedia

musikcubempvlutrispkgs.heroic#pkgs.heroic-unwrappedlegendary-gl # epic launcher#pkgs.steam#steamsteam-runpkgs.protonpluspkgs.pavucontrol

Communication

#pkgs.zapzapwasistlossignal-desktoppkgs.protonmail-desktoppkgs.protonmail-bridge

programs

pkgs.vicinae #server start not at bootfuzzel#rofigearlever

python

python315python313Packages.pippipx

pirate

protonvpn-guiqbittorrent

xorg

xorg.libXcursorxorg.libXixorg.libXineramaxorg.libXScrnSaver

lib

libpnglibpulseaudiolibvorbisstdenv.cc.cc.lib # Provides libstdc++.so.6libkrb5libjxllibadwaita

Secureboot

sbctl

LUKS

tpm2-toolstpm2-tsstpm2-abrmd

Security keys

fido2-managelibfido2gnupg

General utilities

swaybghome-managerbtoprangerkdePackages.filelightlibreoffice-qt-freshkeyutilsbluezopenrgb-with-all-pluginskdePackages.discoverwineWowPackages.waylandFull#pkgs.airgeddonkdePackages.plasma-browser-integrationwgettpm-toolstpm2-toolstpm2-tsswaylandrarunrar-freebatusbutilstldrffmpegimagemagickzipunzip(uutils-coreutils.override { prefix = “”; })nix-prefetch-gitnixfmt-rfc-stylestatixcachixclinfosolaarnettoolstealdeerxclipbat

AMD

amdgpu_top # tool to display AMDGPU usage

Graphics

mesamangohudgamescope

Virtualization stuff

spice-gtkswtpmOVMFFull

Drivers

dxvkvkd3d-proton

Wine

winewinePackages.waylandFullwinetricksprotonup-qt];

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 ).

system.stateVersion = “25.11”; # Did you read the comment?

Activate flakes install

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

Shell set up

for global user

users.defaultUserShell=pkgs.zsh;

For a specific user

users.users.xenomorph.shell = pkgs.zsh;users.users.xenomorph.useDefaultShell = true;programs.zsh.enable = true;

enable zsh and oh my zsh

programs.steam = {enable = true;remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote PlaydedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated ServerlocalNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers};

nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [“steam”“steam-original”“steam-unwrapped”“steam-run”];

services = {

flatpak = {
enable = true;
};
fwupd.enable = true;
spice-vdagentd.enable = true;
spice-webdavd.enable = true;
resolved.enable = true;

gnome.gnome-keyring.enable = true;

};programs = {niri.enable = true; # enable niri as window managerxwayland.enable = true;firefox.enable = true;adb.enable = true;gamescope.enable = true;gamemode.enable = true;nano = {enable = true;nanorc = “set mouseset autoindentset linenumbersset constantshowset noconvertset preserveset smarthomeset tabsize 4set tabstospacesset wordboundsset zapset errorcolor brightwhite,redset functioncolor greenset keycolor cyanset numbercolor cyanset selectedcolor brightwhite,magentaset statuscolor cyanset stripecolor ,yellowset titlecolor brightwhite,blue”;syntaxHighlight = true;};nh = {enable = true;clean = {enable = true;dates = “weekly”;extraArgs = “–keep 5 --keep-since 3d”;};flake = “/etc/nixos/”;};virt-manager = {enable = true;package = pkgs.virt-manager;};

appimage = {
enable = true;
binfmt = true;
};

};

Virtualization software

virtualisation = {spiceUSBRedirection.enable = true;libvirtd = {enable = true;qemu = {vhostUserPackages = [ pkgs.virtiofsd ];swtpm.enable = true;runAsRoot = true;};};};

Allow unstable packages.

nixpkgs.config = {allowUnfree = true;packageOverrides = pkgs: {unstable = import {config = config.nixpkgs.config;};};};

}

```

Can you please use proper codeblocks by enclosing your code in tripple-backticks?

```nix
# code
```

Also your problem is that you do not set nixpkgs.hostPlatform, any recently (within the last 2 years) generated hardware-configuration.nix should contain a sensible default.

And that seems to be exactly the problem, I do not see you importing it, that will very likely cause further problems because you also have no mountpoints set up.

i used the “nixos-generate-config” command to generate my hardware config.

```# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" "uas" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/cc0d4cdd-d718-43a9-bec3-df77c8e0eab4";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/159D-4E20";
      fsType = "vfat";
      options = [ "fmask=0077" "dmask=0077" ];
    };

  swapDevices = [ ];
```
 so how can i import this? Over adding fileSystem option in my configuration.nix? Sry for the stupid questions but im not a programmer and try to learn.

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
```

I’m wondering why it isn’t there in the first place.

Any fresh installation, whether the GUI or the CLI was used, would have created a configuration that had it properly included.

Your configuration as it is now doesn’t look like someone who is only half a week in wrote it. Having the configuration split across multiple files is usually something that comes much later.

But yes, you use the generated hardware configuration exactly the same way, as you use the other modules you wrote and imported.

I was on Fedora before tried there niri and then found NixOs. Found the idea intresting thats, why i try it now. Back to the problem.

i installed it over the GUI installer. i was trying yesterday to split my nixfiles to add vicinae because with the pkgs.vicinae i didnt got the server start automatic.

i follow the flake tutorial video from tony that works. than i tried to add the flake from official vicinae github repo. That gives some error, i dont remember now correctly. Disabled the ./vicinae.nix again and tried to rebuild and had the error with nixpkgs.hostPlatform.

Now i try to add my fileSystem to the configurations.nix.

Using the example format from the wiki added my disk uuid the one from hardwareconfig and tried the one from fdisk. but no success right now.

Is your configuration under version control, such that you can go back to the time before you started messing around?

Got it, added in my flake.nix to modules my ./hardware-configuration.nix and now i can rebuild my system. Thanks for your time helping.