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.
This commit is contained in:
colin 2022-06-14 18:48:55 -07:00
commit a4fd43c1ae
3 changed files with 83 additions and 0 deletions

14
README.md Normal file
View File

@ -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.

44
flake.lock Normal file
View File

@ -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
}

25
flake.nix Normal file
View File

@ -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;
};
}