This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.build-installer-iso: move installer config inline

+99 -88
-79
machines/installer/config.nix
··· 1 - { modulesPath, pkgs, ... }: 2 - 3 - { 4 - imports = [ 5 - # ../../2configs/installer-tor.nix 6 - (modulesPath + "/image/images.nix") 7 - 8 - ]; 9 - 10 - # Basic installer configuration 11 - networking.hostName = "installer"; 12 - 13 - # Enable emergency access in initrd for debugging 14 - boot.initrd.systemd.emergencyAccess = true; 15 - 16 - # Enable serial console for VM usage 17 - boot.kernelParams = [ "console=ttyS0,115200n8" "console=tty0" ]; 18 - 19 - # Configure systemd for serial console 20 - systemd.services."serial-getty@ttyS0" = { 21 - enable = true; 22 - wantedBy = [ "getty.target" ]; 23 - serviceConfig.Restart = "always"; 24 - }; 25 - 26 - # Auto-mount ISO and extract vars 27 - systemd.services.extract-vars = { 28 - description = "Extract vars from ISO"; 29 - wantedBy = [ "multi-user.target" ]; 30 - after = [ "local-fs.target" ]; 31 - path = with pkgs; [ util-linux coreutils ]; 32 - serviceConfig = { 33 - Type = "oneshot"; 34 - RemainAfterExit = true; 35 - }; 36 - script = '' 37 - set -euxo pipefail 38 - 39 - # Find the ISO device (usually sr0, but could be others) 40 - ISO_DEVICE="" 41 - for dev in /dev/sr*; do 42 - if [ -b "$dev" ]; then 43 - ISO_DEVICE="$dev" 44 - break 45 - fi 46 - done 47 - 48 - if [ -z "$ISO_DEVICE" ]; then 49 - echo "No ISO device found, checking loop devices..." 50 - for dev in /dev/loop*; do 51 - if [ -b "$dev" ] && lsblk -no FSTYPE "$dev" 2>/dev/null | grep -q iso9660; then 52 - ISO_DEVICE="$dev" 53 - break 54 - fi 55 - done 56 - fi 57 - 58 - if [ -n "$ISO_DEVICE" ]; then 59 - echo "Found ISO device: $ISO_DEVICE" 60 - mkdir -p /mnt/iso 61 - if mount -t iso9660 -o ro "$ISO_DEVICE" /mnt/iso; then 62 - echo "Successfully mounted ISO" 63 - if [ -d /mnt/iso/vars ]; then 64 - echo "Extracting vars to /vars" 65 - cp -r /mnt/iso/vars /vars 66 - chmod -R u+w /vars 67 - echo "Vars extracted successfully" 68 - else 69 - echo "No vars directory found in ISO" 70 - fi 71 - else 72 - echo "Failed to mount ISO device $ISO_DEVICE" 73 - fi 74 - else 75 - echo "No ISO device found" 76 - fi 77 - ''; 78 - }; 79 - }
-7
machines/installer/physical.nix
··· 1 - { ... }: 2 - 3 - { 4 - imports = [ 5 - ./config.nix 6 - ]; 7 - }
+1 -1
tools/build-installer-iso/build-installer-iso.sh
··· 53 53 54 54 # Build the base ISO 55 55 echo "Building base ISO for $ARCH..." 56 - BASE_ISO=$(nix build -L --no-link --print-out-paths "$FLAKE_ROOT#clanInternals.machines.$ARCH.installer.config.system.build.images.iso-installer") 56 + BASE_ISO=$(nix build -L --no-link --print-out-paths "$FLAKE_ROOT#nixosConfigurations.installer-$ARCH.config.system.build.images.iso-installer") 57 57 58 58 if [ -z "$VARS_DIR" ]; then 59 59 # No vars specified, just copy the base ISO
+98 -1
tools/build-installer-iso/flake-module.nix
··· 1 - { self, ... }: 1 + { self, nixpkgs, clan-core, ... }: 2 + let 3 + # Shared installer configuration module 4 + installerModule = { modulesPath, pkgs, ... }: { 5 + imports = [ 6 + # ../../2configs/installer-tor.nix 7 + (modulesPath + "/image/images.nix") 8 + ]; 9 + 10 + # Basic installer configuration 11 + networking.hostName = "installer"; 12 + 13 + # Enable emergency access in initrd for debugging 14 + boot.initrd.systemd.emergencyAccess = true; 15 + 16 + # Enable serial console for VM usage 17 + boot.kernelParams = [ "console=ttyS0,115200n8" "console=tty0" ]; 18 + 19 + # Configure systemd for serial console 20 + systemd.services."serial-getty@ttyS0" = { 21 + enable = true; 22 + wantedBy = [ "getty.target" ]; 23 + serviceConfig.Restart = "always"; 24 + }; 25 + 26 + # Auto-mount ISO and extract vars 27 + systemd.services.extract-vars = { 28 + description = "Extract vars from ISO"; 29 + wantedBy = [ "multi-user.target" ]; 30 + after = [ "local-fs.target" ]; 31 + path = with pkgs; [ util-linux coreutils ]; 32 + serviceConfig = { 33 + Type = "oneshot"; 34 + RemainAfterExit = true; 35 + }; 36 + script = '' 37 + set -euxo pipefail 38 + 39 + # Find the ISO device (usually sr0, but could be others) 40 + ISO_DEVICE="" 41 + for dev in /dev/sr*; do 42 + if [ -b "$dev" ]; then 43 + ISO_DEVICE="$dev" 44 + break 45 + fi 46 + done 47 + 48 + if [ -z "$ISO_DEVICE" ]; then 49 + echo "No ISO device found, checking loop devices..." 50 + for dev in /dev/loop*; do 51 + if [ -b "$dev" ] && lsblk -no FSTYPE "$dev" 2>/dev/null | grep -q iso9660; then 52 + ISO_DEVICE="$dev" 53 + break 54 + fi 55 + done 56 + fi 57 + 58 + if [ -n "$ISO_DEVICE" ]; then 59 + echo "Found ISO device: $ISO_DEVICE" 60 + mkdir -p /mnt/iso 61 + if mount -t iso9660 -o ro "$ISO_DEVICE" /mnt/iso; then 62 + echo "Successfully mounted ISO" 63 + if [ -d /mnt/iso/vars ]; then 64 + echo "Extracting vars to /vars" 65 + cp -r /mnt/iso/vars /vars 66 + chmod -R u+w /vars 67 + echo "Vars extracted successfully" 68 + else 69 + echo "No vars directory found in ISO" 70 + fi 71 + else 72 + echo "Failed to mount ISO device $ISO_DEVICE" 73 + fi 74 + else 75 + echo "No ISO device found" 76 + fi 77 + ''; 78 + }; 79 + }; 80 + in 2 81 { 82 + flake = { 83 + # Export the installer module for reuse 84 + nixosModules.installer = installerModule; 85 + 86 + # Define installer configurations for each architecture 87 + nixosConfigurations = { 88 + installer-x86_64-linux = nixpkgs.lib.nixosSystem { 89 + system = "x86_64-linux"; 90 + modules = [ installerModule ]; 91 + }; 92 + 93 + installer-aarch64-linux = nixpkgs.lib.nixosSystem { 94 + system = "aarch64-linux"; 95 + modules = [ installerModule ]; 96 + }; 97 + }; 98 + }; 99 + 3 100 perSystem = 4 101 { pkgs, ... }: 5 102 {