more things added
This commit is contained in:
		
							parent
							
								
									15771a522d
								
							
						
					
					
						commit
						24eb83266a
					
				
					 10 changed files with 117 additions and 8 deletions
				
			
		| 
						 | 
					@ -20,7 +20,7 @@
 | 
				
			||||||
    in
 | 
					    in
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      nixosConfigurations = {
 | 
					      nixosConfigurations = {
 | 
				
			||||||
        gateway = kclib.mkHost "gateway" "x86_64-linux";
 | 
					        tailscale-proxy = kclib.mkHost "tailscale-proxy" "x86_64-linux";
 | 
				
			||||||
        entrypoint = kclib.mkHost "entrypoint" "x86_64-linux";
 | 
					        entrypoint = kclib.mkHost "entrypoint" "x86_64-linux";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
 | 
					      formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,7 @@
 | 
				
			||||||
  ...
 | 
					  ...
 | 
				
			||||||
}:
 | 
					}:
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  boot.loader.systemd-boot.enable = true;
 | 
					  nixpkgs.config.allowUnfree = true;
 | 
				
			||||||
  boot.loader.efi.canTouchEfiVariables = true;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  kropcloud = {
 | 
					  kropcloud = {
 | 
				
			||||||
    admin = {
 | 
					    admin = {
 | 
				
			||||||
| 
						 | 
					@ -13,6 +12,11 @@
 | 
				
			||||||
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOUnlAjPnMwJYgZb7YuholdTxifOEFnAyXVqI+xFlHw6 krop@lenar"
 | 
					        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOUnlAjPnMwJYgZb7YuholdTxifOEFnAyXVqI+xFlHw6 krop@lenar"
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    services = {
 | 
				
			||||||
 | 
					      ssh = {
 | 
				
			||||||
 | 
					        enable = true;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  system.stateVersion = "24.11";
 | 
					  system.stateVersion = "24.11";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
{ }: { }
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								hosts/tailscale-proxy.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								hosts/tailscale-proxy.nix
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					{ ... }:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  kropcloud = {
 | 
				
			||||||
 | 
					    services = {
 | 
				
			||||||
 | 
					      tailscale = {
 | 
				
			||||||
 | 
					        enable = true;
 | 
				
			||||||
 | 
					        asRouter.enable = true;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								lib.nix
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								lib.nix
									
									
									
									
									
								
							| 
						 | 
					@ -3,17 +3,25 @@
 | 
				
			||||||
  inputs,
 | 
					  inputs,
 | 
				
			||||||
}:
 | 
					}:
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  mkHost = name: arch: {
 | 
					  mkHost =
 | 
				
			||||||
    nixpkgs.lib.nixosSystem = {
 | 
					    name: arch:
 | 
				
			||||||
 | 
					    nixpkgs.lib.nixosSystem {
 | 
				
			||||||
      system = arch;
 | 
					      system = arch;
 | 
				
			||||||
      modules = [
 | 
					      modules = [
 | 
				
			||||||
        ./hosts/base.nix
 | 
					        ./hosts/base.nix
 | 
				
			||||||
        ./hosts/${name}.nix
 | 
					        ./hosts/${name}.nix
 | 
				
			||||||
        ./nixosModules
 | 
					        ./nixosModules
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					          { ... }:
 | 
				
			||||||
 | 
					          {
 | 
				
			||||||
 | 
					            config = {
 | 
				
			||||||
 | 
					              networking.hostName = name;
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
      specialArgs = {
 | 
					      specialArgs = {
 | 
				
			||||||
        inherit inputs;
 | 
					        inherit inputs;
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
{ }:
 | 
					{ ... }:
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
 | 
					    ./services
 | 
				
			||||||
 | 
					    ./networking
 | 
				
			||||||
    ./users
 | 
					    ./users
 | 
				
			||||||
    ./locale
 | 
					    ./locale
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										26
									
								
								nixosModules/networking/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								nixosModules/networking/default.nix
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,26 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  config,
 | 
				
			||||||
 | 
					  lib,
 | 
				
			||||||
 | 
					  ...
 | 
				
			||||||
 | 
					}:
 | 
				
			||||||
 | 
					let
 | 
				
			||||||
 | 
					  cfg = config.kropcloud.networking;
 | 
				
			||||||
 | 
					in
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  options.kropcloud.networking = {
 | 
				
			||||||
 | 
					    enable = lib.mkOption {
 | 
				
			||||||
 | 
					      type = lib.types.bool;
 | 
				
			||||||
 | 
					      description = "Whence to configure networking";
 | 
				
			||||||
 | 
					      default = true;
 | 
				
			||||||
 | 
					      example = false;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  config = lib.mkIf cfg.enable {
 | 
				
			||||||
 | 
					    networking = {
 | 
				
			||||||
 | 
					      nftables.enable = true;
 | 
				
			||||||
 | 
					      firewall = {
 | 
				
			||||||
 | 
					        checkReversePath = "loose";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										7
									
								
								nixosModules/services/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								nixosModules/services/default.nix
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,7 @@
 | 
				
			||||||
 | 
					{ ... }:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  imports = [
 | 
				
			||||||
 | 
					    ./ssh
 | 
				
			||||||
 | 
					    ./tailscale
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										22
									
								
								nixosModules/services/ssh/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								nixosModules/services/ssh/default.nix
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,22 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  config,
 | 
				
			||||||
 | 
					  lib,
 | 
				
			||||||
 | 
					  ...
 | 
				
			||||||
 | 
					}:
 | 
				
			||||||
 | 
					let
 | 
				
			||||||
 | 
					  cfg = config.kropcloud.services.ssh;
 | 
				
			||||||
 | 
					in
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  options.kropcloud.services.ssh = {
 | 
				
			||||||
 | 
					    enable = lib.mkEnableOption "Whence to enable sshd service.";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  config = lib.mkIf cfg.enable {
 | 
				
			||||||
 | 
					    services.openssh = {
 | 
				
			||||||
 | 
					      enable = true;
 | 
				
			||||||
 | 
					      settings = {
 | 
				
			||||||
 | 
					        PermitRootLogin = "no";
 | 
				
			||||||
 | 
					        PasswordAuthentication = false;
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										30
									
								
								nixosModules/services/tailscale/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								nixosModules/services/tailscale/default.nix
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,30 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  config,
 | 
				
			||||||
 | 
					  lib,
 | 
				
			||||||
 | 
					  ...
 | 
				
			||||||
 | 
					}:
 | 
				
			||||||
 | 
					let
 | 
				
			||||||
 | 
					  cfg = config.kropcloud.services.tailscale;
 | 
				
			||||||
 | 
					in
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  options.kropcloud.services.tailscale = {
 | 
				
			||||||
 | 
					    enable = lib.mkEnableOption "Whence to enable tailscale service.";
 | 
				
			||||||
 | 
					    asRouter = {
 | 
				
			||||||
 | 
					      enable = lib.mkEnableOption "Whence to configure tailscale as router.";
 | 
				
			||||||
 | 
					      subnet = lib.mkOption {
 | 
				
			||||||
 | 
					        type = lib.types.str;
 | 
				
			||||||
 | 
					        default = "192.168.1.0/24";
 | 
				
			||||||
 | 
					        example = "192.168.1.0/24";
 | 
				
			||||||
 | 
					        description = "The subnet to expose";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  config = lib.mkIf cfg.enable {
 | 
				
			||||||
 | 
					    services.tailscale = {
 | 
				
			||||||
 | 
					      enable = true;
 | 
				
			||||||
 | 
					      openFirewall = true;
 | 
				
			||||||
 | 
					      useRoutingFeatures = lib.mkIf cfg.asRouter.enable "server";
 | 
				
			||||||
 | 
					      extraSetFlags = lib.mkIf cfg.asRouter.enable [ "--advertise-routes=${cfg.asRouter.subnet}" ];
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in a new issue