Add netbox host
This commit is contained in:
		
					parent
					
						
							
								61f2d8f07e
							
						
					
				
			
			
				commit
				
					
						a4f3e68aac
					
				
			
		
					 7 changed files with 84 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -37,6 +37,9 @@ in
 | 
			
		|||
      hostNixpkgs = nixpkgs-unstable;
 | 
			
		||||
      site = "vs";
 | 
			
		||||
    };
 | 
			
		||||
    netbox = {
 | 
			
		||||
      site = "vs";
 | 
			
		||||
    };
 | 
			
		||||
    nextcloud = {
 | 
			
		||||
      hostNixpkgs = nixpkgs-unstable;
 | 
			
		||||
      site = "vs";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								hosts/netbox/configuration.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								hosts/netbox/configuration.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  boot.loader.grub = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    device = "/dev/vda";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  networking = {
 | 
			
		||||
    hostName = "netbox";
 | 
			
		||||
    firewall = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      allowedTCPPorts = [ 80 443 ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  system.stateVersion = "23.05";
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								hosts/netbox/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								hosts/netbox/default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./configuration.nix
 | 
			
		||||
    ./netbox.nix
 | 
			
		||||
    ./nginx.nix
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								hosts/netbox/netbox.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								hosts/netbox/netbox.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  services.netbox = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    secretKeyFile = "/secrets/netbox-secret-key.secret";
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										29
									
								
								hosts/netbox/nginx.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								hosts/netbox/nginx.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
{ config, ... }:
 | 
			
		||||
{
 | 
			
		||||
  services.nginx = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    clientMaxBodySize = "25m";
 | 
			
		||||
    user = "netbox";
 | 
			
		||||
    virtualHosts."netbox.grzb.de" = {
 | 
			
		||||
      forceSSL = true;
 | 
			
		||||
      enableACME = true;
 | 
			
		||||
      listen = [
 | 
			
		||||
        {
 | 
			
		||||
          addr = "0.0.0.0";
 | 
			
		||||
          port = 80;
 | 
			
		||||
        }
 | 
			
		||||
        {
 | 
			
		||||
          addr = "0.0.0.0";
 | 
			
		||||
          port = 443;
 | 
			
		||||
          ssl = true;
 | 
			
		||||
        }
 | 
			
		||||
      ];
 | 
			
		||||
      locations."/static/" = {
 | 
			
		||||
        alias = "${config.services.netbox.dataDir}/static/";
 | 
			
		||||
      };
 | 
			
		||||
      locations."/" = {
 | 
			
		||||
        proxyPass = "http://${config.services.netbox.listenAddress}:${builtins.toString config.services.netbox.port}";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								hosts/netbox/secrets.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								hosts/netbox/secrets.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  deployment.keys."netbox-secret-key.secret" = {
 | 
			
		||||
    keyCommand = [ "env" "GNUPGHOME=/home/yuri/.passinfra_gnupg" "PASSWORD_STORE_DIR=/home/yuri/pass/infra" "pass" "netbox/secret-key" ];
 | 
			
		||||
    destDir = "/secrets";
 | 
			
		||||
    user = "netbox";
 | 
			
		||||
    group = "netbox";
 | 
			
		||||
    permissions = "0640";
 | 
			
		||||
    uploadAt = "pre-activation";
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -9,4 +9,13 @@
 | 
			
		|||
      proxyPass = "http://jellyfin.vs.grzb.de:80";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  services.nginx.virtualHosts."netbox.grzb.de" = {
 | 
			
		||||
    listen = [{ 
 | 
			
		||||
      addr = "0.0.0.0";
 | 
			
		||||
      port = 80;
 | 
			
		||||
    }];
 | 
			
		||||
    locations."^~ /.well-known/acme-challenge/" = {
 | 
			
		||||
      proxyPass = "http://netbox.vs.grzb.de:80";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue