Open hughjfchen opened 7 months ago
I followed your post in reddit and tried to build a sdImage for my OPi5 but got following error:
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.
Following is my flake.nix
:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
socle = {
url = "github:dvdjv/socle";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {self, nixpkgs, socle, ...}: {
nixosConfigurations = let
pkgs = import nixpkgs {
localSystem = "x86_64-linux"; crossSystem = "aarch64-linux";
};
in {
orangepi5 = nixpkgs.lib.nixosSystem {
modules = [
socle.nixosModules.orangepi-5
{
nixpkgs.buildPlatform.system = "x86_64-linux";
nixpkgs.config.allowUnfree = true;
#nixpkgs.overlays = [ (final: prev: { mesa = socle.packages.aarch64-linux.mesa-panfork; }) ];
time.timeZone = "Asia/Shanghai";
services.openssh.enable = true;
hardware.deviceTree.enabledOverlays = [
# "rockchip/overlay/rk3588-disable-led.dtbo"
# "rockchip/overlay/rk3588-wifi-ap6275p.dtbo"
];
hardware.opengl.enable = true;
#hardware.opengl.package = nixpkgs.lib.mkForce #socle.packages.aarch64-linux.mesa.drivers;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
boot.tmp.useTmpfs = true;
zramSwap.enable = true;
networking.hostName = "orangepi5";
users.users.chenjf = {
isNormalUser = true;
password = "********";
extraGroups = [ "wheel" ];
packages = with pkgs; [ btop ];
};
}
];
};
};
};
}
Could this be due to cross-compile? I've been trying to build the image in a X86_64 VPS.
Appreciate your interest in my work!
This particular issue you are facing is due to changes I made to support pkgs.nixos
as well as lib.nixosSystem
. You are right, it should be reflected in the README file. I'm planning on adding a template to facilitate creation of SD images. Meanwhile I've created a stable branch you can use. It's lagging behind main
(no libmali, no 3d acceleration), but I won't merge breaking changes there before they are reflected in the documentation. Try using the following flake:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
socle = {
url = "github:dvdjv/socle/stable";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {self, nixpkgs, socle, ...}: {
nixosConfigurations = let
pkgs = import nixpkgs {
localSystem = "x86_64-linux"; crossSystem = "aarch64-linux";
};
in {
orangepi5 = nixpkgs.lib.nixosSystem {
modules = [
socle.nixosModules.orangepi-5
{
nixpkgs.buildPlatform.system = "x86_64-linux";
nixpkgs.config.allowUnfree = true;
time.timeZone = "Asia/Shanghai";
services.openssh.enable = true;
hardware.deviceTree.enabledOverlays = [
# "rockchip/overlay/rk3588-disable-led.dtbo"
# "rockchip/overlay/rk3588-wifi-ap6275p.dtbo"
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
networking.hostName = "orangepi5";
users.users.chenjf = {
isNormalUser = true;
password = "********";
extraGroups = [ "wheel" ];
packages = with pkgs; [ btop ];
};
}
];
};
};
};
}
Came to here from the post under /r/NixOS and want to try it out but don't know how to start. Could you update the README and add some usage instructions? I think your post in reddit maybe a good start.