refactor(treewide): cleanup
This commit is contained in:
		
							parent
							
								
									2fe6c44941
								
							
						
					
					
						commit
						2d93503bbc
					
				
					 30 changed files with 76 additions and 273 deletions
				
			
		|  | @ -1,33 +1,40 @@ | |||
| { config, inputs, pkgs, ... }: | ||||
| { lib, config, inputs, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
| 	key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk"; | ||||
| in | ||||
| 
 | ||||
| { | ||||
| 	imports = [ | ||||
| 		./hardware-configuration.nix | ||||
|     ../../profiles | ||||
| 		]; | ||||
|     ../../modules | ||||
| 	]; | ||||
| 
 | ||||
|     activeProfiles = ["base" "gaming"]; | ||||
| 
 | ||||
| 		systemModules.user = { | ||||
| 			ooks.enable = true; | ||||
| 	systemModules.host = { | ||||
| 		name = "ooksdesk"; | ||||
| 		type = "desktop"; | ||||
| 		function = [ "workstation" "gaming" ]; | ||||
| 		admin = { | ||||
| 			name = "ooks"; | ||||
| 			shell = "fish"; | ||||
| 			sshKey = key; | ||||
| 		}; | ||||
| 
 | ||||
| 		systemModules.hardware = { | ||||
| 		hardware = { | ||||
| 			cpu.type = "amd"; | ||||
| 			cpu.amd.pstate.enable = true; | ||||
| 			gpu.type = "amd"; | ||||
| 			features = [ "ssd" ]; | ||||
| 		}; | ||||
| 	}; | ||||
|   	 | ||||
| 		systemModules.networking.tailscale = { | ||||
| 			enable = true; | ||||
| 			client = true; | ||||
| 		}; | ||||
| 	systemModules.networking.tailscale = { | ||||
| 		enable = true; | ||||
| 		client = true; | ||||
| 	}; | ||||
| 
 | ||||
| 		networking = { | ||||
|   		hostName = "ooksdesk"; 		 | ||||
| 			# useDHCP = true; | ||||
| 		}; | ||||
|     boot = { | ||||
|       kernelPackages = pkgs.linuxPackages_xanmod_latest; | ||||
| 		}; | ||||
|   boot = { | ||||
| 	  kernelPackages = pkgs.linuxPackages_xanmod_latest; | ||||
| 	}; | ||||
| 
 | ||||
|   system.stateVersion = lib.mkDefault "23.11"; | ||||
| } | ||||
|  |  | |||
|  | @ -2,36 +2,26 @@ | |||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./hardware | ||||
|     ./gaming | ||||
|     ./shell | ||||
|     ./bootloader | ||||
|     ./nix | ||||
|     ./programs | ||||
|     ./user | ||||
|     ./displayManager | ||||
|     ./networking | ||||
|     ./locale | ||||
|     ./virtualisation | ||||
|     ./virtualization | ||||
|     ./security | ||||
|     ./services | ||||
|     ./audio | ||||
|     ./meta | ||||
|     ./host | ||||
|     ./video | ||||
|   ]; | ||||
| 
 | ||||
| 
 | ||||
|   options.systemModules = { | ||||
|     pipewire = { | ||||
|       enable = lib.mkEnableOption "Enable pipewire module"; | ||||
|     }; | ||||
|     networking = { | ||||
|       enable = lib.mkEnableOption "Enable networking module"; | ||||
|     }; | ||||
|     virtualisation = { | ||||
|       enable = lib.mkEnableOption "Enable virtualisation module"; | ||||
|     }; | ||||
|     locale = { | ||||
|       enable = lib.mkEnableOption "Enable locale module"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,8 @@ | |||
| { lib, config, pkgs, inputs, ... }: | ||||
| { lib, config, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   cfg = config.systemProfile.gaming; | ||||
|   inherit (lib) mkIf; | ||||
|   inherit (builtins) elem; | ||||
|   steamFix = pkgs.steam.override { | ||||
|     extraPkgs = pkgs: with pkgs; [ | ||||
|       xorg.libXcursor | ||||
|  | @ -21,10 +22,11 @@ let | |||
|       gtk3-x11 | ||||
|     ]; | ||||
|   }; | ||||
|   host = config.systemModules.host; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   config = lib.mkIf cfg.enable { | ||||
|   config = mkIf (elem "gamiing" host.function) { | ||||
|     hardware.opengl.extraPackages = [ pkgs.gamescope ]; | ||||
|     programs = { | ||||
|       steam = { | ||||
|  | @ -63,3 +65,4 @@ in | |||
|     }; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
|  | @ -36,7 +36,7 @@ in | |||
|       isNormalUser = true; | ||||
|       shell = pkgs.${cfg.shell}; | ||||
|       initialPassword = "password"; | ||||
|       openssh.authorizedKeys = "${cfg.sshKey}"; | ||||
|       openssh.authorizedKeys.keys = [ "${cfg.sshKey}" ]; | ||||
|       extraGroups = [ | ||||
|         "wheel" | ||||
|         "video" | ||||
|  |  | |||
|  | @ -4,5 +4,6 @@ | |||
|     ./name | ||||
|     ./type | ||||
|     ./function | ||||
|     ./hardware | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
|  | @ -5,12 +5,6 @@ let | |||
| in | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./gaming | ||||
|     ./workstation | ||||
|     ./media-server | ||||
|   ]; | ||||
| 
 | ||||
|   options.systemModules.host.function = mkOption { | ||||
|     type = with types; listOf (enum ["gaming" "workstation" "media-server"]); | ||||
|     default = []; | ||||
|  |  | |||
|  | @ -2,19 +2,18 @@ | |||
| 
 | ||||
| let | ||||
|   inherit (lib) mkMerge mkEnableOption mkIf versionAtLeast versionOlder; | ||||
|   hardware = config.systemModules.host.hardware.cpu;  | ||||
|   cfg = hardware.amd; | ||||
|   kernelVersion = config.kernelPackages.kernel.version; | ||||
|   inherit (builtins) elem; | ||||
|   cpu = config.systemModules.host.hardware.cpu;  | ||||
|   cfg = cpu.amd; | ||||
|   kernelVersion = config.boot.kernelPackages.kernel.version; | ||||
|   kernelVersionAtLeast = versionAtLeast kernelVersion; | ||||
|   kernelVersionOlder= versionOlder kernelVersion; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   options.systemModules.host.hardware.cpu.amd = { | ||||
|     pstate.enable = mkEnableOption "Enable pstate amd module"; | ||||
|   }; | ||||
|   options.systemModules.host.hardware.cpu.amd.pstate.enable = mkEnableOption "Enable amd pstate module"; | ||||
| 
 | ||||
|   config = mkIf (builtins.elem hardware.type ["amd"]) { | ||||
|   config = mkIf (elem cpu.type ["amd"]) { | ||||
|     environment.systemPackages = [pkgs.amdctl]; | ||||
|     hardware.cpu.amd.updateMicrocode = true; | ||||
|     boot = mkMerge [ | ||||
|  |  | |||
|  | @ -3,6 +3,6 @@ | |||
|     ./cpu | ||||
|     ./gpu | ||||
|     ./features | ||||
|     ./ssd | ||||
|     ./common | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| { lib, config, ... }: | ||||
| 
 | ||||
| let | ||||
|   features = config.systemModules.host.hardware.ssd; | ||||
|   features = config.systemModules.host.hardware.features; | ||||
|   inherit (lib) mkIf; | ||||
|   inherit (builtins) elem; | ||||
| in | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ in | |||
|   }; | ||||
| 
 | ||||
|   config = { | ||||
|     networking.hostname = cfg.name; | ||||
|     networking.hostName = cfg.name; | ||||
|     environment.sessionVariables.HN = cfg.name; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
| let | ||||
|   inherit (lib) mkIf; | ||||
|   host = config.systemModules.type; | ||||
|   host = config.systemModules.host; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| { config, lib, inputs, ... }:  | ||||
| 
 | ||||
| let | ||||
|   inherit (lib) mkIf; | ||||
|   inherit (lib) mkIf mapAttrs mkDefault; | ||||
|   host = config.systemModules.host; | ||||
| in | ||||
| 
 | ||||
|  | @ -10,13 +10,13 @@ in | |||
|     nix = { | ||||
|       settings = { | ||||
|         trusted-users = [ "root" "@wheel" ]; | ||||
|         auto-optimise-store = lib.mkDefault true; | ||||
|         auto-optimise-store = mkDefault true; | ||||
|         experimental-features = [ "nix-command" "flakes" "repl-flake" ]; | ||||
|         warn-dirty = false; | ||||
|         system-features = [ "kvm" "big-parallel" "nixos-test" ]; | ||||
|         flake-registry = ""; | ||||
|       }; | ||||
|       registry = lib.mapAttrs (_: value: { flake = value; }) inputs; | ||||
|       registry = mapAttrs (_: value: { flake = value; }) inputs; | ||||
|       nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ]; | ||||
|     };  | ||||
|   }; | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ let | |||
| in | ||||
| 
 | ||||
| { | ||||
|   config = mkIf host.type != "phone" { | ||||
|   config = mkIf (host.type != "phone") { | ||||
|     nixpkgs = { | ||||
|       overlays = builtins.attrValues outputs.overlays; | ||||
|       config = { | ||||
|  |  | |||
|  | @ -1,14 +1,13 @@ | |||
| { lib, config, ... }: | ||||
| 
 | ||||
| let | ||||
|   inherit (lib) mkIf mkEnableOption; | ||||
|   cfg = config.systemModules.programs.bandwhich; | ||||
|   inherit (lib) mkIf; | ||||
|   inherit (builtins) elem; | ||||
|   host = config.systemModules.host; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   options.systemModules.programs.bandwhich.enable = mkEnableOption "Enable bandwhich system module"; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|   config = mkIf (elem "workstation" host.function) { | ||||
|     programs.bandwhich.enable = true; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,14 +1,13 @@ | |||
| { lib, config, ... }: | ||||
| 
 | ||||
| let | ||||
|   inherit (lib) mkIf mkEnableOption; | ||||
|   cfg = config.systemModules.programs.dconf; | ||||
|   inherit (lib) mkIf; | ||||
|   inherit (builtins) elem; | ||||
|   host = config.systemModules.host; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   options.systemModules.programs.dconf.enable = mkEnableOption "Enable dconf system module"; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|   config = mkIf (elem "workstation" host.function){ | ||||
|     programs.dconf.enable = true; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,14 +1,9 @@ | |||
| { lib, ... }: | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./gnomeServices.nix | ||||
|     ./dconf | ||||
|     ./kdeconnect | ||||
|     ./seahorse | ||||
|     ./wireshark | ||||
|     ./bandwhich | ||||
|   ]; | ||||
| 
 | ||||
|   options.systemModules.programs = { | ||||
|     gnomeServices = { | ||||
|       enable = lib.mkEnableOption "Enable gnome services module"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,18 +0,0 @@ | |||
| { config, lib, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   cfg = config.systemModules.programs.gnomeServices; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   config = lib.mkIf cfg.enable { | ||||
|      services = { | ||||
|       dbus.packages = with pkgs; [ | ||||
|         gcr | ||||
|         gnome.gnome-settings-daemon | ||||
|       ]; | ||||
|       gnome.gnome-keyring.enable = true; | ||||
|       gvfs.enable = true; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | @ -9,9 +9,8 @@ in | |||
|   options.systemModules.services.kdeconnect.enable = mkEnableOption "Enable kdeconnect system module"; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     services.kdeconnect = { | ||||
|     programs.kdeconnect = { | ||||
|       enable = true; | ||||
|       indicator = true; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | @ -1,14 +1,13 @@ | |||
| { lib, config, ... }: | ||||
| 
 | ||||
| let | ||||
|   inherit (lib) mkIf mkEnableOption; | ||||
|   cfg = config.systemModules.programs.seahorse; | ||||
|   inherit (lib) mkIf; | ||||
|   inherit (builtins) elem; | ||||
|   host = config.systemModules.host; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   options.systemModules.programs.seahorse.enable = mkEnableOption "Enable seahorse system module"; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|   config = mkIf (elem "workstation" host.function) { | ||||
|     programs.seahorse.enable = true; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,14 +1,13 @@ | |||
| { lib, config, ... }: | ||||
| 
 | ||||
| let | ||||
|   inherit (lib) mkIf mkEnableOption; | ||||
|   cfg = config.systemModules.programs.wireshark; | ||||
|   inherit (lib) mkIf; | ||||
|   inherit (builtins) elem; | ||||
|   host = config.systemModules.host; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   options.systemModules.programs.wireshark.enable = mkEnableOption "Enable wireshark system module"; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|   config = mkIf (elem "workstation" host.function) { | ||||
|     programs.wireshark.enable = true; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| { | ||||
|   import = [ | ||||
|   imports = [ | ||||
|     ./1password | ||||
|     ./kernel | ||||
|     ./pam | ||||
|  |  | |||
|  | @ -5,7 +5,6 @@ | |||
|   ./mediaServer | ||||
|   ./system76Scheduler | ||||
|   ./dbus | ||||
|   ./kdeconnect | ||||
|   ./gnome | ||||
|   ./gvfs | ||||
|   ]; | ||||
|  |  | |||
|  | @ -7,6 +7,6 @@ in | |||
| 
 | ||||
| { | ||||
|   config = mkIf ( host.type != "phone") { | ||||
|     services.gvfs = true; | ||||
|     services.gvfs.enable = true; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ in | |||
| 
 | ||||
| { | ||||
| 
 | ||||
|   options.systemModules.zsh.enable = mkEnableOption "Enable zsh module"; | ||||
|   options.systemModules.shell.zsh.enable = mkEnableOption "Enable zsh module"; | ||||
| 
 | ||||
|   config = mkIf (adminShell == "zsh" || cfg.enable) { | ||||
|     programs.zsh = { | ||||
|  |  | |||
|  | @ -1,14 +0,0 @@ | |||
| { lib, ... }: | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./shell | ||||
|     ./ooks.nix | ||||
|   ]; | ||||
| 
 | ||||
|   options.systemModules.user = { | ||||
|     ooks = { | ||||
|       enable = lib.mkEnableOption "Enable the user ooks"; | ||||
|     }; | ||||
|   };   | ||||
| } | ||||
|  | @ -1,30 +0,0 @@ | |||
| { lib, pkgs, config, ... }: | ||||
| 
 | ||||
| let  | ||||
|   ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; | ||||
|   cfg = config.systemModules.user.ooks; | ||||
| in | ||||
| 
 | ||||
| { | ||||
|   config = lib.mkIf cfg.enable { | ||||
|     users.users.ooks = { | ||||
|       isNormalUser = true; | ||||
|       extraGroups = [ | ||||
|       "wheel" | ||||
|       "video" | ||||
|       "audio" | ||||
|       ] ++ ifTheyExist [ | ||||
|       "git" | ||||
|       "media" | ||||
|       "network" | ||||
|       "libvirtd" | ||||
|       "deluge" | ||||
|       "streamer" | ||||
|       "torrenter" | ||||
|       ]; | ||||
| 
 | ||||
|     packages = [ pkgs.home-manager ]; | ||||
|     }; | ||||
|     home-manager.users.ooks = import ../../../home/user/ooks/${config.networking.hostName}; | ||||
|   }; | ||||
| } | ||||
|  | @ -1,69 +0,0 @@ | |||
| { inputs, outputs, lib, config, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   isx86Linux = pkgs: with pkgs.stdenv; hostPlatform.isLinux && hostPlatform.isx86; | ||||
|   cfg = config.systemProfile.base; | ||||
| in | ||||
| 
 | ||||
| { | ||||
| 
 | ||||
|   imports = [ | ||||
|     ../../modules | ||||
|     inputs.home-manager.nixosModules.home-manager | ||||
|   ]; | ||||
|    | ||||
|   config = lib.mkIf cfg.enable { | ||||
|     systemModules = { | ||||
|       security.enable = true; | ||||
|       nixOptions.enable = true; | ||||
|       pipewire.enable = true; | ||||
|       networking = { | ||||
|         enable = true; | ||||
|         firewall = true; | ||||
|         resolved = true; | ||||
|         ssh = true; | ||||
|         tools = true; | ||||
|         hardenTcp = true; | ||||
|       }; | ||||
| 
 | ||||
|       locale.enable = true; | ||||
|       bootloader.systemd.enable = true; | ||||
|       programs.gnomeServices.enable = true; | ||||
|       displayManager.tuigreet.enable = true; | ||||
|       hardware.ssd.enable = true; | ||||
|       services.system76Scheduler.enable = true; | ||||
|     }; | ||||
| 
 | ||||
|     environment.systemPackages = [pkgs.git]; | ||||
|     environment.enableAllTerminfo = true; | ||||
|      | ||||
|     services = { | ||||
|       dbus.enable = true; # Need this for gtk | ||||
|       printing.enable = true; # Do I even print? | ||||
|       udisks2 = { # Used to manage mount of temp storage | ||||
|         enable = true; | ||||
|         mountOnMedia = true; # Auto mounts device to /media | ||||
|       }; | ||||
|     }; | ||||
| 
 | ||||
|     boot.supportedFilesystems = ["ntfs"]; # For when someone hands me a usb | ||||
| 
 | ||||
|     programs = { | ||||
|       dconf.enable = true; | ||||
|       kdeconnect.enable = true; | ||||
|     }; | ||||
| 
 | ||||
|     home-manager.extraSpecialArgs = { inherit inputs outputs; }; | ||||
| 
 | ||||
|     hardware = { | ||||
|       enableAllFirmware = true; | ||||
|       enableRedistributableFirmware = true; | ||||
|       opengl = { | ||||
|         enable = true; | ||||
|         driSupport = true; | ||||
|         driSupport32Bit = isx86Linux pkgs; | ||||
|       }; | ||||
|     }; | ||||
|     system.stateVersion = lib.mkDefault "23.11"; | ||||
|   };  | ||||
| } | ||||
|  | @ -1,32 +0,0 @@ | |||
| { lib, config, ... }: | ||||
| 
 | ||||
| let | ||||
|   profileEnabler = let | ||||
|     reducer = l: r: {"${r}".enable = true;} // l; | ||||
|   in | ||||
|     builtins.foldl' reducer {} config.activeProfiles; | ||||
| in | ||||
| { | ||||
|   imports = [ | ||||
|     ./base | ||||
|     ./gaming | ||||
|   ]; | ||||
| 
 | ||||
|   options = { | ||||
|     activeProfiles = lib.mkOption { | ||||
|       type = lib.types.listOf lib.types.str; | ||||
|       default = []; | ||||
|     }; | ||||
|      | ||||
|     systemProfile = { | ||||
|       base = { | ||||
|         enable = lib.mkEnableOption "Enable the base profile"; | ||||
|       }; | ||||
|       gaming = { | ||||
|         enable = lib.mkEnableOption "Enable the gaming profile"; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|    | ||||
|   config.systemProfile = profileEnabler; | ||||
| } | ||||
|  | @ -1,17 +0,0 @@ | |||
| { config, lib, ... }: | ||||
| let | ||||
|   cfg = config.systemProfile.mediaServer; | ||||
| in  | ||||
| { | ||||
|   imports = [ | ||||
|     ../../modules | ||||
|   ]; | ||||
|    | ||||
|   config = lib.mkIf cfg.enable { | ||||
|     systemModules = { | ||||
|       services = { | ||||
|         nixarr.enable = true; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue