build an image which can boot from SD if tow-boot is installed to the eMMC

temporarily disabled some modules to get a smaller, faster to iterate,
image.

need to test flashing tow-boot to the start of the SD card
This commit is contained in:
colin 2022-06-17 19:45:53 -07:00
parent 3fa96fad06
commit 4e3a152ae9
5 changed files with 64 additions and 15 deletions

View File

@ -22,17 +22,16 @@
"mobile-nixos": {
"flake": false,
"locked": {
"lastModified": 1653513225,
"narHash": "sha256-DjIrBfb3cbLG15cWKpSIfBxorXCMWVBeFOc1K7HOzw4=",
"lastModified": 1654281294,
"narHash": "sha256-hT2/u0jUOD4TFU6YyYt+5Gt+hjIeerLTyZG7ru79aDU=",
"owner": "nixos",
"repo": "mobile-nixos",
"rev": "efbe2c3c5409c868309ae0770852638e623690b5",
"rev": "d798b0b34240b18a08c22f5c0ee1f59a3ce43c01",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "mobile-nixos",
"rev": "efbe2c3c5409c868309ae0770852638e623690b5",
"type": "github"
}
},
@ -52,16 +51,16 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1653060744,
"narHash": "sha256-kfRusllRumpt33J1hPV+CeCCylCXEU7e0gn2/cIM7cY=",
"lastModified": 1655278232,
"narHash": "sha256-H6s7tnHYiDKFCcLADS4sl1sUq0dDJuRQXCieguk/6SA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dfd82985c273aac6eced03625f454b334daae2e8",
"rev": "8b538fcb329a7bc3d153962f17c509ee49166973",
"type": "github"
},
"original": {
"id": "nixpkgs",
"rev": "dfd82985c273aac6eced03625f454b334daae2e8",
"ref": "nixos-22.05",
"type": "indirect"
}
},

View File

@ -1,10 +1,9 @@
{
inputs = {
# nixpkgs.url = "nixpkgs/nixos-22.05";
nixpkgs.url = "nixpkgs/dfd82985c273aac6eced03625f454b334daae2e8";
nixpkgs.url = "nixpkgs/nixos-22.05";
mobile-nixos = {
# url = "github:nixos/mobile-nixos";
url = "github:nixos/mobile-nixos/efbe2c3c5409c868309ae0770852638e623690b5";
url = "github:nixos/mobile-nixos";
# url = "github:nixos/mobile-nixos/efbe2c3c5409c868309ae0770852638e623690b5";
flake = false;
};
home-manager.url = "github:nix-community/home-manager/release-22.05";
@ -21,6 +20,6 @@
./modules/default.nix
];
});
pinephone-img = nixosConfigurations.pinephone.config.mobile.outputs.u-boot.disk-image;
pinephone-img = nixosConfigurations.pinephone.config.system.build.raw;
};
}

View File

@ -1,9 +1,11 @@
{ ... }:
{
imports = [
./fs.nix
./hardware.nix
./home-manager.nix
./phosh.nix
# ./home-manager.nix
./image.nix
# ./phosh.nix
./users.nix
];

28
modules/fs.nix Normal file
View File

@ -0,0 +1,28 @@
{ lib, ... }:
{
# boot.initrd.supportedFilesystems = [ "ext4" "btrfs" "ext2" "ext3" "vfat" ];
# Use the systemd-boot EFI boot loader.
boot.loader.grub.enable = false;
# boot.loader.systemd-boot.enable = true;
# boot.loader.systemd-boot.configurationLimit = 20; # keep this many generations
# boot.loader.efi.canTouchEfiVariables = true;
boot.loader.generic-extlinux-compatible.enable = true;
mobile.bootloader.enable = lib.mkForce false;
# boot.loader.grub.enable = true;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.grub.device = "nodev";
hardware.enableRedistributableFirmware = true;
fileSystems."/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-img";
fsType = "ext4";
};
}

21
modules/image.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, lib, pkgs, modulesPath, ... }:
{
# fileSystems."/" = {
# # boot by label instead of unpredictable uuid
# device = "/dev/disk/by-label/nixos-img";
# # make-disk-image only supports ext4
# fsType = "ext4";
# };
# # fileSystems."/boot".device = "/dev/vda1";
# fileSystems."/boot".device = "/dev/disk/by-label/ESP";
system.build.raw = import "${toString modulesPath}/../lib/make-disk-image.nix" {
inherit lib config pkgs;
partitionTableType = "efi";
label = "nixos-img";
fsType = config.fileSystems."/".fsType;
diskSize = "auto";
format = "raw";
};
}