From a4fd43c1ae3b1fee16fe384df8c04a793de2e3d6 Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 14 Jun 2022 18:48:55 -0700 Subject: [PATCH] minimal NixOS boot to login prompt note that we pin mobile-nixos and nixpkgs: the nixpkgs pin might be unnecessary, however the mobile-nixos pin is essential because the uboot target creates a non-bootable image shortly after the chosen commit. mobile-nixos is in the process of switching away from uboot and to tow-boot. --- README.md | 14 ++++++++++++++ flake.lock | 44 ++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 25 +++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..3389b0d --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +build from any nix machine with: +```sh +nix build './#pinephone-img' +``` + +if nix complains about some "experimental features", then add to the host's nix config: `nix.extraOptions = "experimental-features = nix-command flakes";` + +flash with: +```sh +sudo dd if=$(readlink result) of=/dev/sdb bs=4M oflag=direct conv=sync status=progress +``` + +then insert the SD card, battery into your pinephone and hold the power button for a few seconds until the power LED turns red. +after releasing the power button, the LED should turn yellow, then green. you'll see the "mobile NixOS" splash screen and then be dropped into a TTY login prompt. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4ed6aa4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "mobile-nixos": { + "flake": false, + "locked": { + "lastModified": 1653513225, + "narHash": "sha256-DjIrBfb3cbLG15cWKpSIfBxorXCMWVBeFOc1K7HOzw4=", + "owner": "nixos", + "repo": "mobile-nixos", + "rev": "efbe2c3c5409c868309ae0770852638e623690b5", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "mobile-nixos", + "rev": "efbe2c3c5409c868309ae0770852638e623690b5", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1653060744, + "narHash": "sha256-kfRusllRumpt33J1hPV+CeCCylCXEU7e0gn2/cIM7cY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dfd82985c273aac6eced03625f454b334daae2e8", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "rev": "dfd82985c273aac6eced03625f454b334daae2e8", + "type": "indirect" + } + }, + "root": { + "inputs": { + "mobile-nixos": "mobile-nixos", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a60643b --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + inputs = { + # nixpkgs.url = "nixpkgs/nixos-22.05"; + nixpkgs.url = "nixpkgs/dfd82985c273aac6eced03625f454b334daae2e8"; + mobile-nixos = { + # url = "github:nixos/mobile-nixos"; + url = "github:nixos/mobile-nixos/efbe2c3c5409c868309ae0770852638e623690b5"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, mobile-nixos }: { + pinephone-img = (nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + (import "${mobile-nixos}/lib/configuration.nix" { + device = "pine64-pinephone"; + }) + ({ ... }: { + nixpkgs.config.allowUnfree = true; + }) + ]; + }).config.mobile.outputs.u-boot.disk-image; + }; +}