Adds live installer configurations for arm machines

This commit is contained in:
willemml 2023-11-06 11:30:21 -08:00
parent 187eea4a75
commit 20fec7794c
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
6 changed files with 120 additions and 3 deletions

View file

@ -52,6 +52,24 @@
];
};
nixosConfigurations.m1-installer-live = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.appleSilicon
self.nixosModules.base
../../nixos/hosts/live.nix
../../nixos/hosts/asahi-live.nix
];
};
nixosConfigurations.arm-live = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.base
../../nixos/hosts/live.nix
];
};
darwinConfigurations.zeus = inputs.darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [

View file

@ -0,0 +1,39 @@
{pkgs, ...}: {
boot.postBootCommands = let
inherit (config.hardware.asahi.pkgs) asahi-fwextract;
in ''
for o in $(</proc/cmdline); do
case "$o" in
live.nixos.passwd=*)
set -- $(IFS==; echo $o)
echo "nixos:$2" | ${pkgs.shadow}/bin/chpasswd
;;
esac
done
echo Extracting Asahi firmware...
mkdir -p /tmp/.fwsetup/{esp,extracted}
mount /dev/disk/by-partuuid/`cat /proc/device-tree/chosen/asahi,efi-system-partition` /tmp/.fwsetup/esp
${asahi-fwextract}/bin/asahi-fwextract /tmp/.fwsetup/esp/asahi /tmp/.fwsetup/extracted
umount /tmp/.fwsetup/esp
pushd /tmp/.fwsetup/
cat /tmp/.fwsetup/extracted/firmware.cpio | ${pkgs.cpio}/bin/cpio -id --quiet --no-absolute-filenames
mkdir -p /lib/firmware
mv vendorfw/* /lib/firmware
popd
rm -rf /tmp/.fwsetup
'';
hardware.asahi.extractPeripheralFirmware = false;
isoImage.squashfsCompression = "zstd -Xcompression-level 6";
networking.wireless.enable = false;
networking.wireless.iwd = {
enable = true;
settings.General.EnableNetworkConfiguration = true;
};
}

57
nixos/hosts/live.nix Normal file
View file

@ -0,0 +1,57 @@
{pkgs, ...}: {
networking.hostName = "nixos-live";
isoImage.makeEfiBootable = true;
documentation.nixos.enable = true;
users.users.willem.initialHashedPassword = "";
users.users.root.initialHashedPassword = "";
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
services.getty.autologinUser = "willem";
services.openssh.enable = true;
environment.systemPackages = with pkgs; [
curl
ddrescue
efibootmgr
efivar
fuse
fuse3
gptfdisk
hdparm
ms-sys
nano
nvme-cli
parted
pciutils
screen
sdparm
smartmontools
socat
sshfs-fuse
testdisk
unzip
usbutils
wget
w3m-nographics
zip
mesa
];
# Include support for various filesystems and tools to create / manipulate them.
boot.supportedFilesystems =
["btrfs" "cifs" "f2fs" "jfs" "ntfs" "reiserfs" "vfat" "xfs"]
++ lib.optional (lib.meta.availableOn pkgs.stdenv.hostPlatform config.boot.zfs.package) "zfs";
boot.enableContainers = false;
# Configure host id for ZFS to work
networking.hostId = lib.mkDefault "8425e349";
}

View file

@ -1,6 +1,4 @@
{pkgs, ...}: {
imports = [../profiles/linux/base.nix];
boot.extraModulePackages = [];
boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod"];

View file

@ -1,7 +1,7 @@
{pkgs, ...}: {
environment.pathsToLink = ["/share/zsh"];
environment.shells = [pkgs.bashInteractive pkgs.zsh];
environment.systemPackages = [pkgs.coreutils-full];
environment.systemPackages = [pkgs.coreutils-full pkgs.git];
environment.variables.LANG = "en_US.UTF-8";
environment.variables.LANGUAGE = "en_US.UTF-8";
environment.variables.LC_ALL = "en_US.UTF-8";
@ -21,6 +21,7 @@
export PS1=$'\n'"\e[0mbash: \e[34;1m\w"$'\n'"\e[32m\\$\e[0m "
'';
documentation.enable = true;
documentation.man.enable = true;
programs.zsh.enable = true;

View file

@ -2,6 +2,7 @@
imports = [../common.nix];
console.keyMap = "colemak";
console.packages = [pkgs.terminus_font];
i18n.defaultLocale = "en_US.UTF-8";
@ -22,5 +23,8 @@
users.users.willem = {
isNormalUser = true;
extraGroups = ["networkmanager" "wheel"];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBx1z962nl87rmOk/vw3EBSgqU/VlCqON8zTeLHQcSBp willem@zeus"
];
};
}