Refactor
This commit is contained in:
		
							parent
							
								
									0152e1a95f
								
							
						
					
					
						commit
						a1ab0811bb
					
				
							
								
								
									
										42
									
								
								default.nix
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								default.nix
									
									
									
									
									
								
							|  | @ -2,11 +2,10 @@ | |||
| 
 | ||||
| with lib; | ||||
| with lib.my; | ||||
| with inputs; | ||||
| { | ||||
|   imports = | ||||
|     # I use home-manager to deploy files to $HOME; little else | ||||
|     [ home-manager.nixosModules.home-manager ] | ||||
|     [ inputs.home-manager.nixosModules.home-manager ] | ||||
|     # All my personal modules | ||||
|     ++ (mapModulesRec' (toString ./modules) import); | ||||
| 
 | ||||
|  | @ -16,26 +15,27 @@ with inputs; | |||
| 
 | ||||
|   # Configure nix and nixpkgs | ||||
|   environment.variables.NIXPKGS_ALLOW_UNFREE = "1"; | ||||
|   nix = { | ||||
|     package = pkgs.nixFlakes; | ||||
|     extraOptions = "experimental-features = nix-command flakes"; | ||||
|     nixPath = (mapAttrsToList (n: v: "${n}=${v}") inputs) ++ [ | ||||
|       "nixpkgs-overlays=${dotFilesDir}/overlays" | ||||
|       "dotfiles=${dotFilesDir}" | ||||
|     ]; | ||||
|     binaryCaches = [ | ||||
|       "https://nix-community.cachix.org" | ||||
|     ]; | ||||
|     binaryCachePublicKeys = [ | ||||
|       "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" | ||||
|     ]; | ||||
|     registry = { | ||||
|       nixos.flake = nixpkgs; | ||||
|       nixpkgs.flake = nixpkgs-unstable; | ||||
|   nix = | ||||
|     let filteredInputs = filterAttrs (n: _: n != "self") inputs; | ||||
|         nixPathInputs  = mapAttrsToList (n: v: "${n}=${v}") filteredInputs; | ||||
|         registryInputs = mapAttrs (_: v: { flake = v; }) filteredInputs; | ||||
|     in { | ||||
|       package = pkgs.nixFlakes; | ||||
|       extraOptions = "experimental-features = nix-command flakes"; | ||||
|       nixPath = nixPathInputs ++ [ | ||||
|         "nixpkgs-overlays=${dotFilesDir}/overlays" | ||||
|         "dotfiles=${dotFilesDir}" | ||||
|       ]; | ||||
|       binaryCaches = [ | ||||
|         "https://nix-community.cachix.org" | ||||
|       ]; | ||||
|       binaryCachePublicKeys = [ | ||||
|         "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" | ||||
|       ]; | ||||
|       registry = registryInputs // { dotfiles.flake = inputs.self; }; | ||||
|       useSandbox = true; | ||||
|     }; | ||||
|     useSandbox = true; | ||||
|   }; | ||||
|   system.configurationRevision = mkIf (self ? rev) self.rev; | ||||
|   system.configurationRevision = with inputs; mkIf (self ? rev) self.rev; | ||||
|   system.stateVersion = "20.09"; | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -59,7 +59,7 @@ | |||
|         { dotfiles = import ./.; } // mapModulesRec ./modules import; | ||||
| 
 | ||||
|       nixosConfigurations = | ||||
|         mapHosts ./hosts { inherit system; }; | ||||
|         mapHosts ./hosts {}; | ||||
| 
 | ||||
|       devShell."${system}" = | ||||
|         import ./shell.nix { inherit pkgs; }; | ||||
|  |  | |||
|  | @ -2,12 +2,12 @@ | |||
| 
 | ||||
| with lib; | ||||
| with lib.my; | ||||
| let system = "x86_64-linux"; | ||||
| let sys = "x86_64-linux"; | ||||
| in { | ||||
|   mkHost = path: attrs @ { system ? system, ... }: | ||||
|   mkHost = path: attrs @ { system ? sys, ... }: | ||||
|     nixosSystem { | ||||
|       inherit system; | ||||
|       specialArgs = { inherit lib inputs; }; | ||||
|       specialArgs = { inherit lib inputs system; }; | ||||
|       modules = [ | ||||
|         { | ||||
|           nixpkgs.pkgs = pkgs; | ||||
|  |  | |||
|  | @ -9,7 +9,4 @@ rec { | |||
|   configDir   = "${dotFilesDir}/config"; | ||||
|   binDir      = "${dotFilesDir}/bin"; | ||||
|   themesDir   = "${modulesDir}/themes"; | ||||
|   homeDir = "/home/${let name = getEnv "USERNAME"; in | ||||
|                      if elem name [ "" "root" ] | ||||
|                      then "hlissner" else name}"; | ||||
| } | ||||
|  |  | |||
|  | @ -47,7 +47,7 @@ in { | |||
|         # Enable userContent.css and userChrome.css for our theme modules | ||||
|         "toolkit.legacyUserProfileCustomizations.stylesheets" = true; | ||||
|         # Stop creating ~/Downloads! | ||||
|         "browser.download.dir" = "${homeDir}/dl"; | ||||
|         "browser.download.dir" = "${config.user.home}/dl"; | ||||
|         # Don't use the built-in password manager; a nixos user is more likely | ||||
|         # using an external one (you are using one, right?). | ||||
|         "signon.rememberSignons" = false; | ||||
|  |  | |||
|  | @ -113,7 +113,7 @@ in { | |||
| 
 | ||||
|     # Clean up leftovers, as much as we can | ||||
|     system.userActivationScripts.cleanupHome = '' | ||||
|       pushd "${homeDir}" | ||||
|       pushd "${config.user.home}" | ||||
|       rm -rf .compose-cache .nv .pki .dbus .fehbg | ||||
|       [ -s .xsession-errors ] || rm -f .xsession-errors* | ||||
|       popd | ||||
|  |  | |||
|  | @ -24,15 +24,17 @@ with lib.my; | |||
|   }; | ||||
| 
 | ||||
|   config = { | ||||
|     user = { | ||||
|       description = "The primary user account"; | ||||
|       extraGroups = [ "wheel" ]; | ||||
|       isNormalUser = true; | ||||
|       name = let name = builtins.getEnv "USER"; in | ||||
|              if elem name [ "" "root" ] | ||||
|              then "hlissner" else name; | ||||
|       uid = 1000; | ||||
|     }; | ||||
|     user = | ||||
|       let user = builtins.getEnv "USER"; | ||||
|           name = if elem user [ "" "root" ] then "hlissner" else user; | ||||
|       in { | ||||
|         inherit name; | ||||
|         description = "The primary user account"; | ||||
|         extraGroups = [ "wheel" ]; | ||||
|         isNormalUser = true; | ||||
|         home = "/home/${name}"; | ||||
|         uid = 1000; | ||||
|       }; | ||||
| 
 | ||||
|     # Install user packages to /etc/profiles instead. Necessary for | ||||
|     # nixos-rebuild build-vm to work. | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ in { | |||
|   config = mkIf cfg.enable { | ||||
|     services.transmission = { | ||||
|       enable = true; | ||||
|       home = "${homeDir}/torrents"; | ||||
|       home = "${config.user.home}/torrents"; | ||||
|       settings = { | ||||
|         incomplete-dir-enabled = true; | ||||
|         rpc-whitelist = "127.0.0.1,192.168.*.*"; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue