From 079c9c37a50621d224b98cd42acbc3afd0eaf5d8 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 12 Jul 2022 16:39:43 +0200 Subject: [PATCH] Initial commit --- .gitattributes | 1 + README.md | 17 +++++++++++++++++ sd-image.nix | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 .gitattributes create mode 100644 README.md create mode 100644 sd-image.nix diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..12b3be8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..96903e2 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Custom SD image for Raspberry Pi 4 + +This repository contains the instructions and configuration to build a SD image with a bigger /boot partition size and my SSH public keys + +## Usage + +1. Enable QEMU on the host machine by adding the following option + +```{nix} +boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; +``` + +2. Build the image + +```{bash} +nix-build '' -A config.system.build.sdImage -I nixos-config=./sd-image.nix --argstr system aarch64-linux +``` diff --git a/sd-image.nix b/sd-image.nix new file mode 100644 index 0000000..b8f274b --- /dev/null +++ b/sd-image.nix @@ -0,0 +1,19 @@ +{ ... }: { + imports = [ + + ]; + + # Add SSH key + users.extraUsers.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea" + ]; + users.extraUsers.nixos = { + isNormalUser = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea" + ]; + }; + + # Increase /boot partition size + sdImage.firmwareSize = 256; +}