refactor: split systems into archetypes
refactor(module): move kernel config to module refactor(module): move nix config to module refactor(module): move networking config to module refactor(module): move nix config to module refactor(module): move grub config to module
This commit is contained in:
		
							parent
							
								
									067bc992b6
								
							
						
					
					
						commit
						b43660c227
					
				
					 9 changed files with 228 additions and 66 deletions
				
			
		
							
								
								
									
										40
									
								
								modules/nixos/archetypes/workstation/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								modules/nixos/archetypes/workstation/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   inputs, | ||||
| 
 | ||||
|   namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal". | ||||
|   system, # The system architecture for this host (eg. `x86_64-linux`). | ||||
|   target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). | ||||
|   format, # A normalized name for the system target (eg. `iso`). | ||||
|   virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. | ||||
|   systems, # An attribute map of your defined hosts. | ||||
| 
 | ||||
|   config, | ||||
|   ... | ||||
| }: with lib; with lib.${namespace}; | ||||
| let | ||||
|   cfg = config.${namespace}.archetypes.workstation; | ||||
| in { | ||||
|   options.${namespace}.archetypes.workstation = { enable = mkEnableOption "Enable the workstation archetype for your current system"; }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     environment.sessionVariables = { | ||||
|       NIXOS_OZONE_WL = "1"; # Chromium/Electron native Wayland support | ||||
|       MOZ_ENABLE_WAYLAND = "1"; # Firefox native Wayland support | ||||
|     }; | ||||
| 
 | ||||
|     # Enable modules | ||||
|     puzzlevision = { | ||||
|       common = { | ||||
|         nix.enable = true; # Standard Nix configuration | ||||
|         grub.enable = true; # Bootloader grub | ||||
|         networking.enable = true; # Networkmanager configuration | ||||
|         kernel.enable = true; # Kernel modifications | ||||
|         bluetooth.enable = true; # Bluetooth support | ||||
|       }; | ||||
| 
 | ||||
|       desktop.gnome.enable = true; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										37
									
								
								modules/nixos/common/bluetooth/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								modules/nixos/common/bluetooth/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   inputs, | ||||
| 
 | ||||
|   namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal". | ||||
|   system, # The system architecture for this host (eg. `x86_64-linux`). | ||||
|   target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). | ||||
|   format, # A normalized name for the system target (eg. `iso`). | ||||
|   virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. | ||||
|   systems, # An attribute map of your defined hosts. | ||||
| 
 | ||||
|   config, | ||||
|   ... | ||||
| }: with lib; with lib.${namespace}; | ||||
| let | ||||
|   cfg = config.${namespace}.common.bluetooth; | ||||
| in { | ||||
|   options.${namespace}.common.bluetooth = { enable = mkEnableOption "Enable bluetooth support on your current system"; }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     hardware.bluetooth = { | ||||
|       enable = true; | ||||
|       powerOnBoot = true; | ||||
|       package = pkgs.bluez; | ||||
| 
 | ||||
|       settings = { | ||||
|         General = { | ||||
|           ControllerMode = "dual"; | ||||
|           FastConnectable = "true"; | ||||
|           Experimental = "true"; | ||||
|           KernelExperimental = "true"; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										38
									
								
								modules/nixos/common/grub/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								modules/nixos/common/grub/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   inputs, | ||||
| 
 | ||||
|   namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal". | ||||
|   system, # The system architecture for this host (eg. `x86_64-linux`). | ||||
|   target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). | ||||
|   format, # A normalized name for the system target (eg. `iso`). | ||||
|   virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. | ||||
|   systems, # An attribute map of your defined hosts. | ||||
| 
 | ||||
|   config, | ||||
|   ... | ||||
| }: with lib; with lib.${namespace}; | ||||
| let | ||||
|   cfg = config.${namespace}.common.grub; | ||||
| in { | ||||
|   options.${namespace}.common.grub = { enable = mkEnableOption "grub"; }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     boot.loader.grub = { | ||||
|       enable = true; | ||||
|       devices = [ "nodev" ]; | ||||
|       efiInstallAsRemovable = true; | ||||
|       efiSupport = true; | ||||
| 
 | ||||
|       extraEntries = '' | ||||
|         menuentry "Reboot" { | ||||
|           reboot | ||||
|         } | ||||
|         menuentry "Poweroff" { | ||||
|           halt | ||||
|         } | ||||
|       ''; | ||||
|     }; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										32
									
								
								modules/nixos/common/kernel/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								modules/nixos/common/kernel/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   inputs, | ||||
| 
 | ||||
|   namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal". | ||||
|   system, # The system architecture for this host (eg. `x86_64-linux`). | ||||
|   target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). | ||||
|   format, # A normalized name for the system target (eg. `iso`). | ||||
|   virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. | ||||
|   systems, # An attribute map of your defined hosts. | ||||
| 
 | ||||
|   config, | ||||
|   ... | ||||
| }: with lib; with lib.${namespace}; | ||||
| let | ||||
|   cfg = config.${namespace}.common.kernel; | ||||
| in { | ||||
|   options.${namespace}.common.kernel = { | ||||
|     enable = mkEnableOption "Modify the standard kernel settings"; | ||||
|     version = mkOption { | ||||
|       type = lib.types.str; | ||||
|       default = "latest"; | ||||
|       example = "latest"; | ||||
|       description = "Set the kernel version to be used by your system" | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     kernelPackages = pkgs.linuxPackages_${cfg.version}; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										24
									
								
								modules/nixos/common/networking/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								modules/nixos/common/networking/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   inputs, | ||||
| 
 | ||||
|   namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal". | ||||
|   system, # The system architecture for this host (eg. `x86_64-linux`). | ||||
|   target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). | ||||
|   format, # A normalized name for the system target (eg. `iso`). | ||||
|   virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. | ||||
|   systems, # An attribute map of your defined hosts. | ||||
| 
 | ||||
|   config, | ||||
|   ... | ||||
| }: with lib; with lib.${namespace}; | ||||
| let | ||||
|   cfg = config.${namespace}.common.networking; | ||||
| in { | ||||
|   options.${namespace}.common.networking = { enable = mkEnableOption "networking"; }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     networking.networkmanager.enable = true; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										40
									
								
								modules/nixos/common/nix/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								modules/nixos/common/nix/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   inputs, | ||||
| 
 | ||||
|   namespace, # The flake namespace, set in flake.nix. If not set, defaults to "internal". | ||||
|   system, # The system architecture for this host (eg. `x86_64-linux`). | ||||
|   target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). | ||||
|   format, # A normalized name for the system target (eg. `iso`). | ||||
|   virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. | ||||
|   systems, # An attribute map of your defined hosts. | ||||
| 
 | ||||
|   config, | ||||
|   ... | ||||
| }: with lib; with lib.${namespace}; | ||||
| let | ||||
|   cfg = config.${namespace}.common.nix; | ||||
| in { | ||||
|   options.${namespace}.common.nix = { enable = mkEnableOption "nix"; }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     nix = { | ||||
|       settings = { | ||||
|         auto-optimise-store = true; | ||||
|         builders-use-substitutes = true; | ||||
|         experimental-features = [ "nix-command" "flakes" ]; | ||||
|         keep-derivations = true; | ||||
|         keep-outputs = true; | ||||
|         max-jobs = "auto"; | ||||
|       }; | ||||
| 
 | ||||
|       # Garbage collection configuration. | ||||
|       gc = { | ||||
|         automatic = true; | ||||
|         dates = "daily"; | ||||
|         options = "--delete-older-than 3d"; | ||||
|       }; | ||||
|     }; | ||||
|   } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue