lappy-gpt: inline nixos-generate logic for better boot consistency

this image boots!
This commit is contained in:
2022-05-21 22:00:38 -07:00
parent bd3bf6d108
commit 06b23e92f9
4 changed files with 42 additions and 91 deletions

37
flake.lock generated
View File

@@ -56,42 +56,6 @@
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1636849918,
"narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1652457860,
"narHash": "sha256-fZZRON0geucxAFCEamzuZ5z4oj7xJj+6C9HWm1JY2n0=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "11f97f971383d036159edd9221f1b3a60ed78c4f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1629048390,
@@ -156,7 +120,6 @@
"inputs": {
"home-manager": "home-manager",
"mobile-nixos": "mobile-nixos",
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs_2",
"pkgs-gitea": "pkgs-gitea",
"pkgs-mobile": "pkgs-mobile"

View File

@@ -22,13 +22,9 @@
url = "github:nix-community/home-manager/release-21.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, pkgs-gitea, pkgs-mobile, mobile-nixos, home-manager, nixos-generators }: {
outputs = { self, nixpkgs, pkgs-gitea, pkgs-mobile, mobile-nixos, home-manager }: {
nixosConfigurations.uninsane = self.decl-machine {
system = "aarch64-linux";
extraModules = [ ./uninsane ];
@@ -39,45 +35,19 @@
extraModules = [ ./lappy ];
};
nixosConfigurations.lappy-iso = self.decl-machine {
system = "x86_64-linux";
extraModules = [
./lappy
"${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix"
({ pkgs, ...}: {
isoImage.isoName = "lappy-iso";
isoImage.makeEfiBootable = true;
isoImage.makeUsbBootable = true;
isoImage.edition = "minimal";
isoImage.squashfsCompression = "gzip";
})
];
};
nixosConfigurations.lappy-sd = self.decl-machine {
system = "x86_64-linux";
extraModules = [
./lappy
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image.nix"
({ pkgs, ...}: {
sdImage.imageName = "lappy-sd";
sdImage.compressImage = false;
sdImage.populateRootCommands = "";
sdImage.populateFirmwareCommands = "";
})
];
};
packages.x86_64-linux.lappy-gpt = (nixos-generators.nixosGenerate {
pkgs = self.genpkgs.x86_64-linux.pkgs;
specialArgs = { home-manager = home-manager; };
modules = [
./configuration.nix
./lappy
./modules
];
format = "raw-efi";
}).content;
packages.x86_64-linux.lappy-gpt = let
image = nixpkgs.lib.nixosSystem {
pkgs = self.genpkgs.x86_64-linux.pkgs;
system = "x86_64-linux";
specialArgs = { home-manager = home-manager; };
modules = [
./configuration.nix
./lappy
./modules
./image.nix
];
};
in image.config.system.build.raw;
nixosConfigurations.pda = pkgs-mobile.lib.nixosSystem {
# inherit (self.genpkgs.aarch64-linux) pkgs;

20
image.nix Normal file
View File

@@ -0,0 +1,20 @@
{ config, lib, pkgs, modulesPath, ... }:
{
fileSystems."/" = {
# boot by label instead of unpredictable uuid
device = "/dev/disk/by-label/nixos";
# 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";
fsType = config.fileSystems."/".fsType;
diskSize = "auto";
format = "raw";
};
}

View File

@@ -6,6 +6,8 @@
# find more of these with sensors-detect
boot.kernelModules = [ "coretemp" "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "boot.shell_on_fail" ];
boot.consoleLogLevel = 7;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
@@ -27,21 +29,17 @@
pkgs.vaapiIntel
];
# funky defaulting/forcing here because:
# - we want to support image generation, where fs is defined by label instead of UUID
# - we want images to have btrfs roots, not ext4 default
fileSystems."/" = {
device = lib.mkDefault "/dev/disk/by-uuid/75230e56-2c69-4e41-b03e-68475f119980";
fsType = lib.mkForce "btrfs";
options = lib.mkDefault [
fileSystems."/" = lib.mkDefault {
device = "/dev/disk/by-uuid/75230e56-2c69-4e41-b03e-68475f119980";
fsType = "btrfs";
options = [
"compress=zstd"
"defaults"
];
autoResize = lib.mkForce false;
};
fileSystems."/boot" = lib.mkDefault {
device = "/dev/disk/by-uuid/BD79-D6BB";
fileSystems."/boot" = {
device = lib.mkDefault "/dev/disk/by-uuid/BD79-D6BB";
fsType = "vfat";
};