Hyprland
Hyprland copied to clipboard
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?
@fufexan
I don't have enough context about your pkgs
to know what's wrong.
Are you setting nixpkgs.pkgs
like I do here? Or are you letting the module system import it by itself?
I do not get this error, and neither does @colemickens. So there must be something different between our nixpkgs versions.
Something else I could add is to try using nixos-unstable
instead of 22.11.
I'm experiencing this problem. Followed steps in wiki.
I'm experiencing this problem. Followed steps in wiki.
Did you solved it?
Edit because I'm dumb
Is hardware-configuration.nix
actually being imported by your flake?
Running nixos-generate-config
wouldn't fix anything if /etc/nixos/hardware-configuration.nix
isn't actually imported by the flake.
Edit 2 Try adding this to your inputs
inputs.nixpkgs.follows = "nixpkgs";
Original Message:
Do you have something like this in hardware-configuration.nix
?
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
Edit 2 Try adding this to your inputs
inputs.nixpkgs.follows = "nixpkgs";
Why, exactly? This means you no longer get cache hits.
Edit 2 Try adding this to your inputs
inputs.nixpkgs.follows = "nixpkgs";
Why, exactly? This means you no longer get cache hits.
Adding inputs.nixpkgs.follows = "nixpkgs";
to my flake file resulted in the following error
error: stack overflow (possible infinite recursion)
I resolved the problem by simply including the hardware-configuration.nix
in the same location as the configuration.nix
which is being called by the flake.nix
Hi! @itsOnly1Jah - Could you share your config directory structure?
I am getting the same error on a fresh install and my configuration.nix, hardware-configuration.nix, and flake.nix are all in the same /etc/nixos directory.
Hi! @itsOnly1Jah - Could you share your config directory structure?
I am getting the same error on a fresh install and my configuration.nix, hardware-configuration.nix, and flake.nix are all in the same /etc/nixos directory.
I store my flake in a .setup directory of my home folder like so. The only file that references the hardware-configurarion.nix
is my configuration.nix
file.
├── flake.lock
├── flake.nix
├── hosts
│ ├── configuration.nix
│ ├── default.nix
│ ├── hardware-configuration.nix
│ └── home.nix
└── modules
Thank you very much. I'll give this structure a go over the weekend and hopefully fixes my issue as well.
Dritan
On January 23, 2023 6:54:03 PM EST, itsOnly1Jah @.***> wrote:
Hi! @itsOnly1Jah - Could you share your config directory structure?
I am getting the same error on a fresh install and my configuration.nix, hardware-configuration.nix, and flake.nix are all in the same /etc/nixos directory.
I store my flake in a .setup directory of my home folder like so. The only file that references the
hardware-configurarion.nix
is myconfiguration.nix
file.├── flake.lock ├── flake.nix ├── hosts │ ├── configuration.nix │ ├── default.nix │ ├── hardware-configuration.nix │ └── home.nix └── modules
-- > Reply to this email directly or view it on GitHub:
https://github.com/hyprwm/Hyprland/issues/1334#issuecomment-1401163905
You are receiving this because you commented.
Message ID: @.***>
Thank you very much. I'll give this structure a go over the weekend and hopefully fixes my issue as well. -- Dritan … On January 23, 2023 6:54:03 PM EST, itsOnly1Jah @.> wrote: > Hi! @itsOnly1Jah - Could you share your config directory structure? > > > I am getting the same error on a fresh install and my configuration.nix, hardware-configuration.nix, and flake.nix are all in the same /etc/nixos directory. I store my flake in a .setup directory of my home folder like so. The only file that references the
hardware-configurarion.nix
is myconfiguration.nix
file.├── flake.lock ├── flake.nix ├── hosts │ ├── configuration.nix │ ├── default.nix │ ├── hardware-configuration.nix │ └── home.nix └── modules
-- > Reply to this email directly or view it on GitHub: #1334 (comment) You are receiving this because you commented. Message ID: @.>
Hi my friend, I am a noob in nix but I find a solution on web which add system = "xxxxx" line
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ....... ]; };
If you're putting flake.nix
and configuration.nix
in the same place, make sure to import configuration.nix
in flake.nix
If you're putting
flake.nix
andconfiguration.nix
in the same place, make sure to importconfiguration.nix
inflake.nix
Do you mind clarifying what you mean here? I am new to NixOS and can't find an obvious way to import the configuration.nix in to the flake.nix.
Thanks!
If you're putting
flake.nix
andconfiguration.nix
in the same place, make sure to importconfiguration.nix
inflake.nix
Do you mind clarifying what you mean here? I am new to NixOS and can't find an obvious way to import the configuration.nix in to the flake.nix.
Thanks!
Just add it to your nixosConfiguration modules
is ok.
such as this one (original flake comes from Hyprland Wiki)
# 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;}
./configuration.nix # Just like this, add the position of your configuration.nix to here
# ...
];
};
};
}