started draft for installer
This commit is contained in:
		
							parent
							
								
									c487b26112
								
							
						
					
					
						commit
						9d88822266
					
				
					 5 changed files with 94 additions and 15 deletions
				
			
		
							
								
								
									
										30
									
								
								build-installer.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								build-installer.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | ||||||
|  | #!/usr/bin/env bash | ||||||
|  | 
 | ||||||
|  | while [ $# -gt 0 ]; do | ||||||
|  |   case "$1" in | ||||||
|  |     --flake*|-f*) | ||||||
|  |       if [[ "$1" != *=* ]]; then shift; fi | ||||||
|  |       flake="${1#*=}" | ||||||
|  |       ;; | ||||||
|  |     # --user*|-u*) | ||||||
|  |     #   if [[ "$1" != *=* ]]; then shift; fi | ||||||
|  |     #   user="${1#*=}" | ||||||
|  |     #   ;; | ||||||
|  |     --help|-h) | ||||||
|  |       echo "--help -h: print this message" | ||||||
|  |       echo "--flake -f: set the flake to build an installer for" | ||||||
|  |     #   echo "--user -u: set the user to install flake as on the target system" | ||||||
|  |       exit 0 | ||||||
|  |       ;; | ||||||
|  |     *) | ||||||
|  |       echo "Error: Invalid argument $1" | ||||||
|  |       exit 1 | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  |   shift | ||||||
|  | done | ||||||
|  | 
 | ||||||
|  | flake=${flake:-"basic"} | ||||||
|  | user=${user:-$USER} | ||||||
|  | 
 | ||||||
|  | nix build .#installerConfigurations.$flake.config.system.build.isoImage | ||||||
							
								
								
									
										19
									
								
								configurations/installer/basic/configuration.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								configurations/installer/basic/configuration.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | ||||||
|  | { | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   modulesPath, | ||||||
|  |   ... | ||||||
|  | }: { | ||||||
|  |   imports = [(modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")]; | ||||||
|  | 
 | ||||||
|  |   systemd.services.sshd.wantedBy = pkgs.lib.mkForce ["multi-user.target"]; | ||||||
|  |   users.users.root.openssh.authorizedKeys.keys = [ | ||||||
|  |     "ssh-ed25519 AaAeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee username@host" | ||||||
|  |   ]; | ||||||
|  | 
 | ||||||
|  |   isoImage.squashfsCompression = "gzip -Xcompression-level 1"; | ||||||
|  | 
 | ||||||
|  |   networking.hostName = "installer"; | ||||||
|  | 
 | ||||||
|  |   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								configurations/installer/basic/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								configurations/installer/basic/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | {...}: { | ||||||
|  |   imports = [ | ||||||
|  |     ./configuration.nix | ||||||
|  |   ]; | ||||||
|  | } | ||||||
							
								
								
									
										45
									
								
								flake.nix
									
										
									
									
									
								
							
							
						
						
									
										45
									
								
								flake.nix
									
										
									
									
									
								
							|  | @ -76,10 +76,30 @@ | ||||||
|     util = import ./util {inherit inputs;}; |     util = import ./util {inherit inputs;}; | ||||||
|     forEachPkgs = util.forEachPkgs; |     forEachPkgs = util.forEachPkgs; | ||||||
| 
 | 
 | ||||||
|  |     mkNixosInstaller = util.mkNixosInstaller; | ||||||
|     mkNixosSystem = util.mkNixosSystem; |     mkNixosSystem = util.mkNixosSystem; | ||||||
|     mkDarwinSystem = util.mkDarwinSystem; |     mkDarwinSystem = util.mkDarwinSystem; | ||||||
|     mkHome = util.mkHome; |     mkHome = util.mkHome; | ||||||
| 
 | 
 | ||||||
|  |     installerSystems = { | ||||||
|  |       basic = mkNixosInstaller "basic" []; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     nixosSystems = { | ||||||
|  |       horizon = mkNixosSystem "horizon"; | ||||||
|  |       twilight = mkNixosSystem "twilight"; | ||||||
|  |       defiant = mkNixosSystem "defiant"; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     darwinSystems = { | ||||||
|  |       hesperium = mkDarwinSystem "hesperium"; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     homeSystems = { | ||||||
|  |       # stand alone home manager configurations here: | ||||||
|  |       # name = mkHome "name" | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|     systemsHomes = nixpkgs.lib.attrsets.mergeAttrsList ( |     systemsHomes = nixpkgs.lib.attrsets.mergeAttrsList ( | ||||||
|       nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: ( |       nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: ( | ||||||
|         nixpkgs.lib.attrsets.mapAttrs' (user: _: { |         nixpkgs.lib.attrsets.mapAttrs' (user: _: { | ||||||
|  | @ -88,8 +108,12 @@ | ||||||
|         }) |         }) | ||||||
|         system.config.home-manager.users |         system.config.home-manager.users | ||||||
|       )) |       )) | ||||||
|       (inputs.self.nixosConfigurations // inputs.self.darwinConfigurations) |       (nixosSystems // darwinSystems) | ||||||
|     ); |     ); | ||||||
|  | 
 | ||||||
|  |     homeConfigurations = | ||||||
|  |       systemsHomes | ||||||
|  |       // homeSystems; | ||||||
|   in { |   in { | ||||||
|     formatter = forEachPkgs (pkgs: pkgs.alejandra); |     formatter = forEachPkgs (pkgs: pkgs.alejandra); | ||||||
| 
 | 
 | ||||||
|  | @ -113,21 +137,12 @@ | ||||||
|       }; |       }; | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     nixosConfigurations = { |     installerConfigurations = installerSystems; | ||||||
|       horizon = mkNixosSystem "horizon"; |  | ||||||
|       twilight = mkNixosSystem "twilight"; |  | ||||||
|       defiant = mkNixosSystem "defiant"; |  | ||||||
|     }; |  | ||||||
| 
 | 
 | ||||||
|     darwinConfigurations = { |     nixosConfigurations = nixosSystems; | ||||||
|       hesperium = mkDarwinSystem "hesperium"; |  | ||||||
|     }; |  | ||||||
| 
 | 
 | ||||||
|     homeConfigurations = |     darwinConfigurations = darwinSystems; | ||||||
|       systemsHomes | 
 | ||||||
|       // { |     homeConfigurations = homeConfigurations; | ||||||
|         # stand alone configurations here: |  | ||||||
|         # name = mkHome "name" |  | ||||||
|       }; |  | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -55,6 +55,16 @@ in { | ||||||
|       (lib.mkUnless condition no) |       (lib.mkUnless condition no) | ||||||
|     ]; |     ]; | ||||||
| 
 | 
 | ||||||
|  |   mkNixosInstaller = host: userKeys: | ||||||
|  |     nixpkgs.lib.nixosSystem { | ||||||
|  |       modules = [ | ||||||
|  |         { | ||||||
|  |           # TODO: authorized keys for all users | ||||||
|  |         } | ||||||
|  |         ../configurations/nixos/${host} | ||||||
|  |       ]; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|   mkNixosSystem = host: |   mkNixosSystem = host: | ||||||
|     nixpkgs.lib.nixosSystem { |     nixpkgs.lib.nixosSystem { | ||||||
|       specialArgs = {inherit inputs outputs util;}; |       specialArgs = {inherit inputs outputs util;}; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue