Hyprland: nixpkgs.hostPlatform not set
I want to use Nixos module with flakes to build Hyprland, while got error with nixpkgs.hostPlatform not set.
Command I execute:
sudo nixos-rebuild switch --flake '.#aimi'
Output:
[sudo] password for aimi:
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.
(use '--show-trace' to show detailed location information
Expect output: Everything is ok.
Other message:
NixOS version:
NixOS 22.11
nix version:
nix (Nix) 2.11.1
flake.nix:
# hyprland flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
hyprland.url = "github:hyprwm/Hyprland";
};
outputs = {nixpkgs, hyprland, ...}: {
nixosConfigurations.aimi = nixpkgs.lib.nixosSystem {
# ...
modules = [
hyprland.nixosModules.default
{programs.hyprland.enable = true;}
# ...
];
};
};
}
(the sample one in wiki)
flake.nix place:
/etc/nixos/env/hyprland/flake.nix
I run command in /etc/nixos/env/hyprland/
I checked my hardware-configuration.nix and fount nixpkgs.hostPlatform is ok:
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
And I’ve tried nixos-generate-config, still this error.
Is this my personal environment bug?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (3 by maintainers)
Just add it to your nixosConfiguration
modulesis ok. such as this one (original flake comes from Hyprland Wiki)Adding
inputs.nixpkgs.follows = "nixpkgs";to my flake file resulted in the following errorerror: stack overflow (possible infinite recursion)Edit because I’m dumb Is
hardware-configuration.nixactually being imported by your flake? Runningnixos-generate-configwouldn’t fix anything if/etc/nixos/hardware-configuration.nixisn’t actually imported by the flake.Edit 2 Try adding this to your inputs
Original Message: Do you have something like this in
hardware-configuration.nix?