odroid-m1: simplify README

Remove opinionated configuration that doesn't belong in a hardware
module README: home-manager setup, user/SSH configuration, example
hardware-configuration.nix, and an overly complex multi-host flake
pattern.

Keep only the ODroid M1-specific information: how to build the SD card
image with the required petitboot populateRootCommands, and how to set
up the flake for ongoing nixos-rebuild switch.
This commit is contained in:
Jörg Thalheim 2026-02-15 16:25:49 +01:00
parent 21deaf7ac9
commit 001bac7132

View file

@ -2,15 +2,13 @@
Hardware support for the Hardkernel ODroid M1: https://www.hardkernel.com/shop/odroid-m1-with-8gbyte-ram/ Hardware support for the Hardkernel ODroid M1: https://www.hardkernel.com/shop/odroid-m1-with-8gbyte-ram/
## Initial Installation ## Building an SD Card Image
This is for creating the initial image used to install to the SD Card or NVM Drive. To create an initial SD card image for installation:
Example `flake.nix`:
```nix ```nix
# flake.nix
{ {
description = "SD Card Image Generator for ODroid M1";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:nixos/nixos-hardware/master"; nixos-hardware.url = "github:nixos/nixos-hardware/master";
@ -20,11 +18,11 @@ Example `flake.nix`:
modules = [ modules = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
nixos-hardware.nixosModules.hardkernel-odroid-m1 nixos-hardware.nixosModules.hardkernel-odroid-m1
./sdimageconfiguration.nix ./sdimage.nix
{ {
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.hostPlatform.system = "aarch64-linux"; nixpkgs.hostPlatform.system = "aarch64-linux";
nixpkgs.buildPlatform.system = "x86_64-linux"; # If you build on x86 otherwise change this. # Uncomment if cross-compiling from x86_64:
# nixpkgs.buildPlatform.system = "x86_64-linux";
} }
]; ];
}; };
@ -33,176 +31,70 @@ Example `flake.nix`:
} }
``` ```
For building the initial sd card image, you can use this example (tweaked for your preferences) `sdimageconfiguration.nix`:
```nix ```nix
{ config, pkgs, lib, ... }: # sdimage.nix
{ config, ... }:
{ {
system.stateVersion = lib.mkDefault "25.11"; imports = [ ./common.nix ];
nixpkgs.hostPlatform.system = "aarch64-linux";
sdImage = { sdImage = {
# Skip compression, we'll want the img uncompressed for flashing anyway
compressImage = false; compressImage = false;
# The system will not boot if this is missing # Required for the system to boot
populateRootCommands = '' populateRootCommands = ''
${config.boot.loader.petitboot.populateCmd} -c ${config.system.build.toplevel} -d ./files/kboot.conf ${config.boot.loader.petitboot.populateCmd} -c ${config.system.build.toplevel} -d ./files/kboot.conf
''; '';
}; };
}
```
services.openssh = { ```nix
enable = true; # common.nix
settings = { { pkgs, ... }:
# Highly recommended: Set Password Authentication to false if you have authorized keys you can use. This is an insecure default {
PasswordAuthentication = true; services.openssh.enable = true;
PermitRootLogin = "no";
AllowUsers = [ "odroid" ];
};
};
# You will almost certainly want Git to pull in your configuration repository environment.systemPackages = [ pkgs.git ];
environment.systemPackages = [
pkgs.git
];
users.users.odroid = { users.users.odroid = {
isNormalUser = true; isNormalUser = true;
description = "Default User"; extraGroups = [ "wheel" ];
extraGroups = [ "networkmanager" "wheel" ]; initialPassword = "odroid";
packages = []; # openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAA..." ];
# Highly recommended: Change this default password using `sudo passwd` after logging in
initialPassword = lib.mkForce "odroid";
# You can find this from https://github.com/username.keys for example
openssh.authorizedKeys.keys = [];
}; };
} }
``` ```
Put both of these files into a Git repo, and build with: Build with:
```sh ```sh
nix build .#images.m1 nix build .#images.m1
``` ```
## Ongoing updates ## Ongoing Configuration
To your NixOS server flake, you'll want to ensure that the host is set to aarch64-linux. After booting the SD card image, run `nixos-generate-config` to generate
`hardware-configuration.nix` for your system. Then set up your configuration
An example flake: flake:
```nix ```nix
# flake.nix
{ {
description = "My NixOS configuration flake";
inputs = { inputs = {
# Nixpkgs - Stable 25.11 release nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
# Home Manager - Stable 25.11 release
home-manager.url = "github:nix-community/home-manager/release-25.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# NixOS Hardware
nixos-hardware.url = "github:nixos/nixos-hardware/master"; nixos-hardware.url = "github:nixos/nixos-hardware/master";
}; };
outputs = { nixpkgs, nixos-hardware, ... }: {
outputs = { nixosConfigurations.m1 = nixpkgs.lib.nixosSystem {
self,
nixpkgs,
home-manager,
nixos-hardware,
...
}@inputs:
let
mkSystem = hostname: systemArchitecture: # hostname: is a positional argument
nixpkgs.lib.nixosSystem {
system = systemArchitecture;
specialArgs = { inherit inputs; };
modules = [ modules = [
./hosts/${hostname}/configuration.nix nixos-hardware.nixosModules.hardkernel-odroid-m1
./common.nix
home-manager.nixosModules.home-manager ./configuration.nix
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
}
];
};
hosts = [
{ hostname = "other-example"; systemArchitecture = "x86_64-linux"; }
{ hostname = "odroid-m1-example"; systemArchitecture = "aarch64-linux"; }
];
in
{
# This is what creates the NixOS configurations for each host
nixosConfigurations = builtins.listToAttrs (
# Iterator - nixConfigurations.<name> = <value>
map (host: {
name = host.hostname;
value = mkSystem host.hostname host.systemArchitecture;
})
# Array to iterate over
hosts
);
};
}
```
And the related `configuration.nix`:
```nix
{ config, pkgs, inputs, ... }:
{
imports =
[
inputs.nixos-hardware.nixosModules.hardkernel-odroid-m1
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/nix
../../users
]; ];
networking.hostName = "odroid-m1-example"; # Define your hostname.
}
```
And `hardware-configuration.nix`:
```nix
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
fsType = "ext4";
}; };
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
} }
``` ```
You can generate these default files (with a few warnings) by running the following command on the odroid after initial boot: The module configures petitboot as the boot loader, so `nixos-rebuild switch`
works as usual.
```sh
nixos-generate-config
```
It will save a configuration.nix and hardware-configuration.nix to `/etc/nixos`. Critically, you will need to add `inputs.nixos-hardware.nixosModules.hardkernel-odroid-m1` to the imports in `configuration.nix` for it to work.