diff --git a/hosts/parsons/configuration.nix b/hosts/parsons/configuration.nix index a26b20d..cca2b01 100644 --- a/hosts/parsons/configuration.nix +++ b/hosts/parsons/configuration.nix @@ -21,6 +21,7 @@ ../../services/lantifa.nix ../../services/vaultwarden.nix ../../services/uffd.nix + ../../services/netbox.nix ./lxc.nix ]; diff --git a/services/netbox.nix b/services/netbox.nix new file mode 100644 index 0000000..a91e4a9 --- /dev/null +++ b/services/netbox.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, evalConfig, ... }: + +{ + containers.netbox = { + privateNetwork = true; + hostAddress = "192.168.140.1"; + localAddress = "192.168.140.10"; + autoStart = true; + + path = (evalConfig { + hosts = { }; + groups = { }; + } ({ config, lib, pkgs, profiles, modules, sources, ... }: { + boot.isContainer = true; + networking.useDHCP = false; + users.users.root.hashedPassword = ""; + system.stateVersion = "21.11"; + + imports = [ sources.nix-hexchen.nixosModules.profiles.nopersist ]; + + services.netbox = { + enable = true; + secretKeyFile = "/var/lib/netbox/secret"; + listenAddress = "0.0.0.0"; + }; + + + services.coredns = { + enable = true; + config = '' + .:53 { + forward . 1.1.1.1 + } + ''; + }; + })).config.system.build.toplevel; + }; + + services.nginx.virtualHosts."netbox.infra4future.de" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://${config.containers.netbox.localAddress}:8001"; + }; + }; +}