Add ISO build
This commit is contained in:
		
							parent
							
								
									076bdb3ab4
								
							
						
					
					
						commit
						6f9edd8870
					
				@ -87,11 +87,18 @@
 | 
				
			|||||||
      mkKexec = system:
 | 
					      mkKexec = system:
 | 
				
			||||||
        (nixpkgs.lib.nixosSystem {
 | 
					        (nixpkgs.lib.nixosSystem {
 | 
				
			||||||
          inherit system;
 | 
					          inherit system;
 | 
				
			||||||
          modules = [ ./machines/kexec.nix ];
 | 
					          modules = [ ./machines/ephemeral/kexec.nix ];
 | 
				
			||||||
        }).config.system.build.kexec_tarball;
 | 
					        }).config.system.build.kexec_tarball;
 | 
				
			||||||
 | 
					      mkIso = system:
 | 
				
			||||||
 | 
					        (nixpkgs.lib.nixosSystem {
 | 
				
			||||||
 | 
					          inherit system;
 | 
				
			||||||
 | 
					          modules = [ ./machines/ephemeral/iso.nix ];
 | 
				
			||||||
 | 
					        }).config.system.build.isoImage;
 | 
				
			||||||
    in {
 | 
					    in {
 | 
				
			||||||
      "x86_64-linux"."kexec" = mkKexec "x86_64-linux";
 | 
					      "x86_64-linux"."kexec" = mkKexec "x86_64-linux";
 | 
				
			||||||
 | 
					      "x86_64-linux"."iso" = mkIso "x86_64-linux";
 | 
				
			||||||
      "aarch64-linux"."kexec" = mkKexec "aarch64-linux";
 | 
					      "aarch64-linux"."kexec" = mkKexec "aarch64-linux";
 | 
				
			||||||
 | 
					      "aarch64-linux"."iso" = mkIso "aarch64-linux";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										12
									
								
								machines/ephemeral/iso.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								machines/ephemeral/iso.nix
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					{ modulesPath, ... }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  imports = [
 | 
				
			||||||
 | 
					    (modulesPath + "/installer/cd-dvd/iso-image.nix")
 | 
				
			||||||
 | 
					    ./minimal.nix
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  isoImage.makeUsbBootable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  networking.hostName = "iso";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -6,8 +6,11 @@
 | 
				
			|||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
    (modulesPath + "/installer/netboot/netboot.nix")
 | 
					    (modulesPath + "/installer/netboot/netboot.nix")
 | 
				
			||||||
    (modulesPath + "/profiles/qemu-guest.nix")
 | 
					    (modulesPath + "/profiles/qemu-guest.nix")
 | 
				
			||||||
 | 
					    ./minimal.nix
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  networking.hostName = "kexec";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # stripped down version of https://github.com/cleverca22/nix-tests/tree/master/kexec
 | 
					  # stripped down version of https://github.com/cleverca22/nix-tests/tree/master/kexec
 | 
				
			||||||
  system.build = rec {
 | 
					  system.build = rec {
 | 
				
			||||||
    image = pkgs.runCommand "image" { buildInputs = [ pkgs.nukeReferences ]; } ''
 | 
					    image = pkgs.runCommand "image" { buildInputs = [ pkgs.nukeReferences ]; } ''
 | 
				
			||||||
@ -42,31 +45,4 @@
 | 
				
			|||||||
      contents = [ ];
 | 
					      contents = [ ];
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					 | 
				
			||||||
  boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "e1000" "e1000e" "virtio_pci" "r8169" ];
 | 
					 | 
				
			||||||
  boot.kernelParams = [
 | 
					 | 
				
			||||||
    "panic=30" "boot.panic_on_fail" # reboot the machine upon fatal boot issues
 | 
					 | 
				
			||||||
    "console=ttyS0" # enable serial console
 | 
					 | 
				
			||||||
    "console=tty1"
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
  boot.kernel.sysctl."vm.overcommit_memory" = "1";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  environment.systemPackages = with pkgs; [
 | 
					 | 
				
			||||||
    cryptsetup
 | 
					 | 
				
			||||||
    btrfs-progs
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
  environment.variables.GC_INITIAL_HEAP_SIZE = "1M";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  networking.useDHCP = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  networking.hostName = "kexec";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  services.openssh = {
 | 
					 | 
				
			||||||
    enable = true;
 | 
					 | 
				
			||||||
    challengeResponseAuthentication = false;
 | 
					 | 
				
			||||||
    passwordAuthentication = false;
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  services.getty.autologinUser = "root";
 | 
					 | 
				
			||||||
  users.users.root.openssh.authorizedKeys.keys = (import ../common/ssh.nix).users;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										28
									
								
								machines/ephemeral/minimal.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								machines/ephemeral/minimal.nix
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					{ pkgs, ... }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "e1000" "e1000e" "virtio_pci" "r8169" ];
 | 
				
			||||||
 | 
					  boot.kernelParams = [
 | 
				
			||||||
 | 
					    "panic=30" "boot.panic_on_fail" # reboot the machine upon fatal boot issues
 | 
				
			||||||
 | 
					    "console=ttyS0" # enable serial console
 | 
				
			||||||
 | 
					    "console=tty1"
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					  boot.kernel.sysctl."vm.overcommit_memory" = "1";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  environment.systemPackages = with pkgs; [
 | 
				
			||||||
 | 
					    cryptsetup
 | 
				
			||||||
 | 
					    btrfs-progs
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					  environment.variables.GC_INITIAL_HEAP_SIZE = "1M";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  networking.useDHCP = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.openssh = {
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					    challengeResponseAuthentication = false;
 | 
				
			||||||
 | 
					    passwordAuthentication = false;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.getty.autologinUser = "root";
 | 
				
			||||||
 | 
					  users.users.root.openssh.authorizedKeys.keys = (import ../common/ssh.nix).users;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user