2023-04-16 22:53:29 +02:00
|
|
|
# Creating a SD-Image
|
2023-04-16 22:43:32 +02:00
|
|
|
|
2023-04-16 22:53:29 +02:00
|
|
|
Create and configure the `flake.nix` file:
|
2023-04-16 22:43:32 +02:00
|
|
|
``` nix
|
2023-04-16 22:53:29 +02:00
|
|
|
{
|
2023-04-18 10:40:20 +02:00
|
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2023-04-16 22:53:29 +02:00
|
|
|
inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
|
2023-04-23 18:43:25 +02:00
|
|
|
|
|
|
|
# Some dependencies of this flake are not yet available on non linux systems
|
|
|
|
inputs.systems.url = "github:nix-systems/x86_64-linux";
|
2023-04-16 22:53:29 +02:00
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
2023-04-23 18:43:25 +02:00
|
|
|
inputs.flake-utils.inputs.systems.follows = "systems";
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, nixos-hardware, flake-utils, ... }:
|
2023-04-16 22:53:29 +02:00
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
rec {
|
|
|
|
packages.default = packages.sd-image;
|
|
|
|
packages.sd-image = (import "${nixpkgs}/nixos" {
|
|
|
|
configuration =
|
|
|
|
{ config, ... }: {
|
|
|
|
imports = [
|
|
|
|
"${nixos-hardware}/starfive/visionfive/v2/sd-image-installer.nix"
|
|
|
|
];
|
2023-04-16 22:43:32 +02:00
|
|
|
|
2023-04-16 22:53:29 +02:00
|
|
|
# If you want to use ssh set a password
|
|
|
|
# users.users.nixos.password = "super secure password";
|
|
|
|
# OR add your public ssh key
|
|
|
|
# users.users.nixos.openssh.authorizedKeys.keys = [ "ssh-rsa ..." ];
|
|
|
|
|
|
|
|
# AND configure networking
|
|
|
|
# networking.interfaces.end0.useDHCP = true;
|
|
|
|
# networking.interfaces.end1.useDHCP = true;
|
|
|
|
|
|
|
|
# If you have the 2A variant uncomment the following line
|
|
|
|
# hardware.deviceTree.name =
|
|
|
|
# lib.mkDefault "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb";
|
|
|
|
|
|
|
|
# Additional configuration goes here
|
|
|
|
|
|
|
|
sdImage.compressImage = false;
|
|
|
|
|
|
|
|
nixpkgs.crossSystem = {
|
|
|
|
config = "riscv64-unknown-linux-gnu";
|
|
|
|
system = "riscv64-linux";
|
|
|
|
};
|
|
|
|
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
};
|
|
|
|
inherit system;
|
|
|
|
}).config.system.build.sdImage;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Build the sd image.
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
nix build .#
|
2023-04-16 22:43:32 +02:00
|
|
|
```
|