Simplify flake and expose host pkgs
The configuration of the machines is now moved to m/
This commit is contained in:
		
							parent
							
								
									218acd6848
								
							
						
					
					
						commit
						d679fd6314
					
				| @ -1,9 +0,0 @@ | |||||||
| { options, ... }: |  | ||||||
| 
 |  | ||||||
| { |  | ||||||
|   nix.nixPath = |  | ||||||
|     # Prepend default nixPath values. |  | ||||||
|     options.nix.nixPath.default ++ |  | ||||||
|     # Append our nixpkgs-overlays. |  | ||||||
|     [ "nixpkgs-overlays=${../overlays-compat}" ]; |  | ||||||
| } |  | ||||||
							
								
								
									
										105
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										105
									
								
								flake.nix
									
									
									
									
									
								
							| @ -6,97 +6,22 @@ | |||||||
|     bscpkgs.url = "git+https://pm.bsc.es/gitlab/rarias/bscpkgs.git"; |     bscpkgs.url = "git+https://pm.bsc.es/gitlab/rarias/bscpkgs.git"; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   outputs = { self, nixpkgs, agenix, bscpkgs, ... }: { |   outputs = { self, nixpkgs, agenix, bscpkgs, ... }: | ||||||
|  | let | ||||||
|  |   mkConf = name: nixpkgs.lib.nixosSystem { | ||||||
|  |     system = "x86_64-linux"; | ||||||
|  |     specialArgs = { inherit nixpkgs bscpkgs agenix; theFlake = self; }; | ||||||
|  |     modules = [ "${self.outPath}/m/${name}/configuration.nix" ]; | ||||||
|  |   }; | ||||||
|  | in | ||||||
|  |   { | ||||||
|     nixosConfigurations = { |     nixosConfigurations = { | ||||||
|       xeon01 = nixpkgs.lib.nixosSystem { |       hut     = mkConf "hut"; | ||||||
|         system = "x86_64-linux"; |       owl1    = mkConf "owl1"; | ||||||
|         modules = [ |       owl2    = mkConf "owl2"; | ||||||
|           ( {options, ...}: { |       xeon08  = mkConf "xeon08"; | ||||||
|             # Sel the nixos-config path to the one of the current flake |  | ||||||
|             nixpkgs.overlays = [ bscpkgs.bscOverlay ]; |  | ||||||
|             nix.nixPath = [ |  | ||||||
|                 "nixpkgs=${nixpkgs}" |  | ||||||
|                 "bscpkgs=${bscpkgs}" |  | ||||||
|                 "nixos-config=${self.outPath}/xeon01/configuration.nix" |  | ||||||
|                 "nixpkgs-overlays=${self.outPath}/overlays-compat" |  | ||||||
|             ]; |  | ||||||
|             nix.registry.nixpkgs.flake = nixpkgs; |  | ||||||
|             nix.registry.bscpkgs.flake = bscpkgs; |  | ||||||
|             system.configurationRevision = |  | ||||||
|               if self ? rev |  | ||||||
|               then self.rev |  | ||||||
|               else throw ("Refusing to build from a dirty Git tree!"); |  | ||||||
|           }) |  | ||||||
|           ./xeon01/configuration.nix |  | ||||||
|         ]; |  | ||||||
|       }; |  | ||||||
|       xeon02 = nixpkgs.lib.nixosSystem { |  | ||||||
|         system = "x86_64-linux"; |  | ||||||
|         modules = [ |  | ||||||
|           ( {options, ...}: { |  | ||||||
|             # Sel the nixos-config path to the one of the current flake |  | ||||||
|             nixpkgs.overlays = [ bscpkgs.bscOverlay ]; |  | ||||||
|             nix.nixPath = [ |  | ||||||
|                 "nixpkgs=${nixpkgs}" |  | ||||||
|                 "bscpkgs=${bscpkgs}" |  | ||||||
|                 "nixos-config=${self.outPath}/xeon02/configuration.nix" |  | ||||||
|                 "nixpkgs-overlays=${self.outPath}/overlays-compat" |  | ||||||
|             ]; |  | ||||||
|             nix.registry.nixpkgs.flake = nixpkgs; |  | ||||||
|             nix.registry.bscpkgs.flake = bscpkgs; |  | ||||||
|             system.configurationRevision = |  | ||||||
|               if self ? rev |  | ||||||
|               then self.rev |  | ||||||
|               else throw ("Refusing to build from a dirty Git tree!"); |  | ||||||
|           }) |  | ||||||
|           ./xeon02/configuration.nix |  | ||||||
|         ]; |  | ||||||
|       }; |  | ||||||
|       hut = nixpkgs.lib.nixosSystem { |  | ||||||
|         system = "x86_64-linux"; |  | ||||||
|         modules = [ |  | ||||||
|           ( {options, ...}: { |  | ||||||
|             # Sel the nixos-config path to the one of the current flake |  | ||||||
|             nixpkgs.overlays = [ bscpkgs.bscOverlay ]; |  | ||||||
|             nix.nixPath = [ |  | ||||||
|                 "nixpkgs=${nixpkgs}" |  | ||||||
|                 "bscpkgs=${bscpkgs}" |  | ||||||
|                 "nixos-config=${self.outPath}/hut/configuration.nix" |  | ||||||
|                 "nixpkgs-overlays=${self.outPath}/overlays-compat" |  | ||||||
|             ]; |  | ||||||
|             nix.registry.nixpkgs.flake = nixpkgs; |  | ||||||
|             nix.registry.bscpkgs.flake = bscpkgs; |  | ||||||
|             system.configurationRevision = |  | ||||||
|               if self ? rev |  | ||||||
|               then self.rev |  | ||||||
|               else throw ("Refusing to build from a dirty Git tree!"); |  | ||||||
|           }) |  | ||||||
|           agenix.nixosModules.default |  | ||||||
|           ./hut/configuration.nix |  | ||||||
|         ]; |  | ||||||
|       }; |  | ||||||
|       xeon08 = nixpkgs.lib.nixosSystem { |  | ||||||
|         system = "x86_64-linux"; |  | ||||||
|         modules = [ |  | ||||||
|           ( {options, ...}: { |  | ||||||
|             # Sel the nixos-config path to the one of the current flake |  | ||||||
|             nixpkgs.overlays = [ bscpkgs.bscOverlay ]; |  | ||||||
|             nix.nixPath = [ |  | ||||||
|                 "nixpkgs=${nixpkgs}" |  | ||||||
|                 "bscpkgs=${bscpkgs}" |  | ||||||
|                 "nixos-config=${self.outPath}/xeon08/configuration.nix" |  | ||||||
|                 "nixpkgs-overlays=${self.outPath}/overlays-compat" |  | ||||||
|             ]; |  | ||||||
|             nix.registry.nixpkgs.flake = nixpkgs; |  | ||||||
|             nix.registry.bscpkgs.flake = bscpkgs; |  | ||||||
|             system.configurationRevision = |  | ||||||
|               if self ? rev |  | ||||||
|               then self.rev |  | ||||||
|               else throw ("Refusing to build from a dirty Git tree!"); |  | ||||||
|           }) |  | ||||||
|           ./xeon08/configuration.nix |  | ||||||
|         ]; |  | ||||||
|       }; |  | ||||||
|     }; |     }; | ||||||
|  | 
 | ||||||
|  |     packages.x86_64-linux.hut = self.nixosConfigurations.hut.pkgs; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| { config, pkgs, ... }: | { config, pkgs, nixpkgs, bscpkgs, agenix, theFlake, ... }: | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   imports = [ |   imports = [ | ||||||
| @ -11,6 +11,23 @@ | |||||||
|     ./users.nix |     ./users.nix | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|  |   nixpkgs.overlays = [ bscpkgs.bscOverlay ]; | ||||||
|  | 
 | ||||||
|  |   nix.nixPath = [ | ||||||
|  |     "nixpkgs=${nixpkgs}" | ||||||
|  |     "bscpkgs=${bscpkgs}" | ||||||
|  |     "jungle=${theFlake.outPath}" | ||||||
|  |   ]; | ||||||
|  | 
 | ||||||
|  |   nix.registry.nixpkgs.flake = nixpkgs; | ||||||
|  |   nix.registry.bscpkgs.flake = bscpkgs; | ||||||
|  |   nix.registry.jungle.flake = theFlake; | ||||||
|  | 
 | ||||||
|  |   system.configurationRevision = | ||||||
|  |     if theFlake ? rev | ||||||
|  |     then theFlake.rev | ||||||
|  |     else throw ("Refusing to build from a dirty Git tree!"); | ||||||
|  | 
 | ||||||
|   environment.systemPackages = with pkgs; [ |   environment.systemPackages = with pkgs; [ | ||||||
|     vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option |     vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option | ||||||
|     nix-diff ipmitool freeipmi ethtool lm_sensors ix cmake gnumake file tree |     nix-diff ipmitool freeipmi ethtool lm_sensors ix cmake gnumake file tree | ||||||
| @ -43,12 +43,12 @@ | |||||||
|       10.0.40.143             oss02-ipmi0 |       10.0.40.143             oss02-ipmi0 | ||||||
|        |        | ||||||
|       # Node Entry for node: xeon01 (ID=15) |       # Node Entry for node: xeon01 (ID=15) | ||||||
|       10.0.40.1               xeon01 xeon01-eth0 |       10.0.40.1               xeon01 xeon01-eth0 owl1 | ||||||
|       10.0.42.1               xeon01-ib0 |       10.0.42.1               xeon01-ib0 | ||||||
|       10.0.40.101             xeon01-ipmi0 |       10.0.40.101             xeon01-ipmi0 | ||||||
|        |        | ||||||
|       # Node Entry for node: xeon02 (ID=16) |       # Node Entry for node: xeon02 (ID=16) | ||||||
|       10.0.40.2               xeon02 xeon02-eth0 |       10.0.40.2               xeon02 xeon02-eth0 owl2 | ||||||
|       10.0.42.2               xeon02-ib0 |       10.0.42.2               xeon02-ib0 | ||||||
|       10.0.40.102             xeon02-ipmi0 |       10.0.40.102             xeon02-ipmi0 | ||||||
|        |        | ||||||
| @ -6,7 +6,8 @@ | |||||||
|     controlMachine = "hut"; |     controlMachine = "hut"; | ||||||
|     clusterName = "owl"; |     clusterName = "owl"; | ||||||
|     nodeName = [ |     nodeName = [ | ||||||
|       "xeon[01-02,07]  Sockets=2 CoresPerSocket=14 ThreadsPerCore=2 Feature=xeon" |       "owl[1,2]  Sockets=2 CoresPerSocket=14 ThreadsPerCore=2 Feature=owl" | ||||||
|  |       "hut       Sockets=2 CoresPerSocket=14 ThreadsPerCore=2" | ||||||
|     ]; |     ]; | ||||||
|     extraConfig = '' |     extraConfig = '' | ||||||
|       MpiDefault=pmix |       MpiDefault=pmix | ||||||
| @ -1,4 +1,4 @@ | |||||||
| { config, pkgs, ... }: | { config, pkgs, agenix, ... }: | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   imports = [ |   imports = [ | ||||||
| @ -8,6 +8,7 @@ | |||||||
|     ./monitoring.nix |     ./monitoring.nix | ||||||
|     ./nfs.nix |     ./nfs.nix | ||||||
|     ./slurm-daemon.nix |     ./slurm-daemon.nix | ||||||
|  |     agenix.nixosModules.default | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   # Select the this using the ID to avoid mismatches |   # Select the this using the ID to avoid mismatches | ||||||
| @ -1,8 +0,0 @@ | |||||||
| self: super: |  | ||||||
| with super.lib; |  | ||||||
| let |  | ||||||
|   # Load the system config and get the `nixpkgs.overlays` option |  | ||||||
|   overlays = (import <nixpkgs/nixos> { }).config.nixpkgs.overlays; |  | ||||||
| in |  | ||||||
|   # Apply all overlays to the input of the current "main" overlay |  | ||||||
|   foldl' (flip extends) (_: super) overlays self |  | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user