add network module
This commit is contained in:
		| @@ -18,10 +18,9 @@ | ||||
|     desktop = true; | ||||
|     gpu.amd.enable = true; | ||||
|     laptop = true; | ||||
|     network.hostName = "MaxNixosLaptop"; | ||||
|   }; | ||||
|  | ||||
|   networking.hostName = "MaxNixosLaptop"; # Define your hostname. | ||||
|  | ||||
|   # Define a user account. Don't forget to set a password with ‘passwd’. | ||||
|   users.users.max = { | ||||
|     isNormalUser = true; | ||||
| @@ -30,8 +29,6 @@ | ||||
|     shell = pkgs.zsh; | ||||
|   }; | ||||
|  | ||||
|   networking.firewall.enable = false; | ||||
|  | ||||
|   home-manager = { | ||||
|     extraSpecialArgs = {inherit inputs;}; | ||||
|     users = { | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| }: let | ||||
|   cfg = config.myConfig; | ||||
| in { | ||||
|   imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix ./cache.nix ./nix.nix ./update.nix ./podman.nix ./qemu.nix]; | ||||
|   imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix ./cache.nix ./nix.nix ./update.nix ./podman.nix ./qemu.nix ./bluetooth.nix ./network.nix]; | ||||
|  | ||||
|   options.myConfig = { | ||||
|     enable = lib.mkEnableOption "my custom config"; | ||||
| @@ -17,7 +17,6 @@ in { | ||||
|       example = "foo"; | ||||
|       description = "The main user working on this machine"; | ||||
|       type = lib.types.nonEmptyStr; | ||||
|       readOnly = true; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
| @@ -30,6 +29,7 @@ in { | ||||
|     podman.enable = true; | ||||
|     qemu.enable = true; | ||||
|     qemu.kvm = lib.mkIf (system == "x86_64-linux") true; | ||||
|     network.enable = true; | ||||
|  | ||||
|     greetd.enable = lib.mkIf cfg.desktop true; | ||||
|     sway.enable = lib.mkIf cfg.desktop true; | ||||
| @@ -40,5 +40,6 @@ in { | ||||
|     sway.laptop = lib.mkIf cfg.laptop true; | ||||
|     wifi.enable = lib.mkIf cfg.laptop true; | ||||
|     touch.enable = lib.mkIf cfg.laptop true; | ||||
|     bluetooth.enable = lib.mkIf cfg.laptop true; | ||||
|   }; | ||||
| } | ||||
|   | ||||
							
								
								
									
										24
									
								
								modules/nixos/network.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								modules/nixos/network.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| { | ||||
|   lib, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
|   cfg = config.myConfig.network; | ||||
| in { | ||||
|   options.myConfig.network = { | ||||
|     enable = lib.mkEnableOption "bluetooth"; | ||||
|     hostName = lib.mkOption { | ||||
|       default = null; | ||||
|       example = "host"; | ||||
|       description = "The host name of this machine"; | ||||
|       type = lib.types.nullOr lib.types.nonEmptyStr; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   config = lib.mkIf cfg.enable { | ||||
|     networking = { | ||||
|       hostName = cfg.hostName; | ||||
|       firewall.enable = false; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user