Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chuangzhu/nixos-sun20iw1p1
NixOS on Allwinner D1 RISC-V
https://github.com/chuangzhu/nixos-sun20iw1p1
licheerv linux mangopi riscv sunxi
Last synced: 9 days ago
JSON representation
NixOS on Allwinner D1 RISC-V
- Host: GitHub
- URL: https://github.com/chuangzhu/nixos-sun20iw1p1
- Owner: chuangzhu
- License: mit
- Created: 2022-03-16T20:52:55.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-21T10:11:39.000Z (about 2 years ago)
- Last Synced: 2024-11-13T18:43:24.157Z (about 2 months ago)
- Topics: licheerv, linux, mangopi, riscv, sunxi
- Language: Nix
- Homepage:
- Size: 140 KB
- Stars: 38
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mango-pi-mq-pro - NixOS
README
# NixOS on Allwinner D1
```shellsession
## With Nix flakes
$ nix build .#nixosConfigurations.sdImageLicheeRVInstaller.config.system.build.sdImage## Or without Nix flakes
$ NIX_PATH='nixpkgs=channel:nixos-unstable' nix-build '' -I nixos-config=./sd-image-licheerv-installer.nix --arg system null -A config.system.build.sdImage
```Due to performance limitations of current RISC-V machines, it may not be trivial to build this natively. This project currently *prefers* cross builds from `x86_64-linux`. It is recommended to add [hydra.nichi.co](https://hydra.nichi.co) to your [Nix binary cache](https://nixos.wiki/wiki/Binary_Cache#Using_a_binary_cache).
Prebuilt images can be found on the [GitHub releases page](https://github.com/chuangzhu/nixos-sun20iw1p1/releases).
## Status
The image boots successfully with WiFi and HDMI support. Supported boards:
- [x] Sipeed LicheeRV Dock
- [x] MangoPi MQ-Pro (compatible with LicheeRV)
- [ ] MangoPi MQ[![asciicast](https://asciinema.org/a/484705.svg)](https://asciinema.org/a/484705)
## Other build options
For cross builds from other platforms, edit `sd-image-licheerv-installer.nix`:
```diff
- nixpkgs.buildPlatform = "x86_64-linux";
+ nixpkgs.buildPlatform = "aarch64-linux";
```For native / emulated builds, edit `sd-image-licheerv-installer.nix`:
```diff
- nixpkgs.buildPlatform = "x86_64-linux";
```For emulated builds on NixOS, add this to your system's `configuration.nix`:
```nix
boot.binfmt.emulatedSystems = [ "riscv64-linux" ];
```For emulated builds on non-NixOS, check [this discourse](https://discourse.nixos.org/t/how-to-configure-qemu-binfmt-wrapper-on-a-non-nixos-machine/7879/6).
## Configuration
```nix
# flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-sun20iw1p1.url = "github:chuangzhu/nixos-sun20iw1p1";
};
outputs = { self, nixpkgs, nixos-sun20iw1p1 }: {
nixosConfugurations.myLicheeRV = nixpkgs.lib.nixosSystem {
modules = [
nixos-sun20iw1p1.nixosModules.sd-image-licheerv
./hardware-configuration.nix
./configuration.nix
({ pkgs, config, ... }: {
nixpkgs.buildPlatform = "x86_64-linux";
})
];
};
};
}
```Then you can build your customized SD card image using `nix build .#nixosConfigurations.myLicheeRV.config.system.build.sdImage`.
When you make changes, you can build the new configuration using `nix build .#nixosConfigurations.myLicheeRV.config.system.build.toplevel`, copy it to the running system using `nix copy --no-check-sigs --to ssh://root@ip.to.mylicheerv.example ./result`, then execute `/nix/store/xxxx-nixos-system-myLicheeRV-xxxx/switch-to-configuration switch` on the board.
### Without Nix flakes
```nix
# configuration.nix
{ config, pkgs, lib, ... }: {
imports = [
./hardware-configuration.nix
];
nixpkgs.buildPlatform = "x86_64-linux";
}
``````shellsession
$ NIX_PATH='nixpkgs=channel:nixos-unstable:nixos-sun20iw1p1=https://github.com/chuangzhu/nixos-sun20iw1p1/archive/master.tar.gz' nix-build '' -I nixos-config=configuration.nix --arg system null -A config.system.build.sdImage
```## Credit
I followed [this guide](https://linux-sunxi.org/Allwinner_Nezha#Manual_build) from the linux-sunxi community.
Many thanks to @smaeul and other people's awesome work.
This is based on @NickCao and @zhaofengli's work porting numerous Nix packages to `riscv64-linux`.