diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | nix/installer-bootstrap-cross/default.nix | 5 | ||||
-rw-r--r-- | nix/installer-bootstrap-cross/installer-configuration.nix | 102 | ||||
-rw-r--r-- | nix/kernel/config | 7 | ||||
-rw-r--r-- | nix/overlay.nix | 1 |
5 files changed, 115 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore index 439a67372652..1aca8d47966e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /result /u-boot /m1n1 +/rootfs +/installer bootbits/ diff --git a/nix/installer-bootstrap-cross/default.nix b/nix/installer-bootstrap-cross/default.nix new file mode 100644 index 000000000000..c57d98b2700a --- /dev/null +++ b/nix/installer-bootstrap-cross/default.nix @@ -0,0 +1,5 @@ +{ pkgs }: +(import (pkgs.path + "/nixos/lib/eval-config.nix") { + specialArgs = { nixpkgsPath = pkgs.path; }; + modules = [ ./installer-configuration.nix ]; +}).config.system.build.isoImage diff --git a/nix/installer-bootstrap-cross/installer-configuration.nix b/nix/installer-bootstrap-cross/installer-configuration.nix new file mode 100644 index 000000000000..a0984de9f1d9 --- /dev/null +++ b/nix/installer-bootstrap-cross/installer-configuration.nix @@ -0,0 +1,102 @@ +# this configuration is intended to have just enough stuff to get the disk, +# display, USB input, and network up so the user can build a real config. + +# based vaguely on +# https://github.com/samueldr/cross-system/blob/master/configuration.nix + +{ config, pkgs, lib, nixpkgsPath, ... }: + +{ + imports = [ + (nixpkgsPath + "/nixos/modules/profiles/minimal.nix") + (nixpkgsPath + "/nixos/modules/profiles/installation-device.nix") + (nixpkgsPath + "/nixos/modules/installer/cd-dvd/iso-image.nix") + ]; + + # Adds terminus_font for people with HiDPI displays + console.packages = [ pkgs.terminus_font ]; + + # ISO naming. + isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso"; + + # EFI booting + isoImage.makeEfiBootable = true; + + # An installation media cannot tolerate a host config defined file + # system layout on a fresh machine, before it has been formatted. + swapDevices = lib.mkOverride 60 [ ]; + fileSystems = lib.mkOverride 60 config.lib.isoFileSystems; + + boot.postBootCommands = '' + 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 + ''; + + isoImage.squashfsCompression = "zstd -Xcompression-level 6"; + + boot.consoleLogLevel = 7; + + boot.kernelParams = [ + "earlycon" + "console=ttySAC0,1500000" + "console=tty0" + "debug" + "boot.shell_on_fail" + ]; + + boot.kernelPackages = pkgs.callPackage ../kernel { nativeBuild = false; }; + + # our kernel config is weird and doesn't have these modules as modules + boot.initrd.availableKernelModules = lib.mkForce []; + + # save space and compilation time. might revise? + hardware.enableAllFirmware = lib.mkForce false; + hardware.enableRedistributableFirmware = lib.mkForce false; + sound.enable = false; + networking.wireless.enable = false; + documentation.nixos.enable = lib.mkOverride 49 false; + system.extraDependencies = lib.mkForce [ ]; + + hardware.wirelessRegulatoryDatabase = true; + hardware.firmware = [ + # all the firmware is big, but including the tigon one avoids an awkward + # minute long hang on mac mini + (pkgs.stdenv.mkDerivation { + name = "tigon-firmware"; + buildCommand = '' + mkdir -p $out/lib/firmware + cp -r ${pkgs.firmwareLinuxNonfree}/lib/firmware/tigon $out/lib/firmware + ''; + }) + ]; + + # (Failing build in a dep to be investigated) + security.polkit.enable = false; + + # cifs-utils fails to cross-compile + # Let's simplify this by removing all unneeded filesystems from the image. + boot.supportedFilesystems = lib.mkForce [ "vfat" ]; + + # texinfoInteractive has trouble cross-compiling + documentation.info.enable = lib.mkForce false; + + # `xterm` is being included even though this is GUI-less. + # → https://github.com/NixOS/nixpkgs/pull/62852 + services.xserver.desktopManager.xterm.enable = lib.mkForce false; + + # ec6224b6cd147943eee685ef671811b3683cb2ce re-introduced udisks in the installer + # udisks fails due to gobject-introspection being not cross-compilation friendly. + services.udisks2.enable = lib.mkForce false; + + networking.firewall.enable = false; + + nixpkgs.crossSystem = { + system = "aarch64-linux"; + }; +} diff --git a/nix/kernel/config b/nix/kernel/config index 37dd4d1c9791..f7992114ce05 100644 --- a/nix/kernel/config +++ b/nix/kernel/config @@ -467,8 +467,11 @@ CONFIG_FHANDLE=y CONFIG_CRYPTO_USER_API_HASH=y CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_XZ=y -CONFIG_FS_ISOFS=y +CONFIG_ISO9660_FS=y +CONFIG_ZISOFS=n +CONFIG_JOLIET=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y CONFIG_DMIID=y CONFIG_TMPFS_XATTR=y CONFIG_SECCOMP=y diff --git a/nix/overlay.nix b/nix/overlay.nix index ebf10fb7b8e6..cfdab3945a78 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -22,5 +22,6 @@ in { name: callPackage ./u-boot { withDeviceTree = name; } ); rootfs-bootstrap-cross = callPackage ./rootfs-bootstrap-cross {}; + installer-bootstrap-cross = callPackage ./installer-bootstrap-cross {}; }); } |