diff --git a/hosts/hime/default.nix b/hosts/hime/default.nix index b7c6cad..ea9dcff 100644 --- a/hosts/hime/default.nix +++ b/hosts/hime/default.nix @@ -22,7 +22,6 @@ xkbVariant = ""; }; - virtualisation.docker.enable = true; users = { defaultUserShell = pkgs.nushell; users.oh = { @@ -33,7 +32,6 @@ }; environment.systemPackages = with pkgs; [ - docker-compose hugo wget python3Full diff --git a/hosts/sakura/default.nix b/hosts/sakura/default.nix index f4c7ed7..880cdc9 100644 --- a/hosts/sakura/default.nix +++ b/hosts/sakura/default.nix @@ -6,6 +6,7 @@ imports = [ ./hardware-configuration.nix ../../modules + ../../modules/services ]; boot.loader = { @@ -16,7 +17,6 @@ useOSProber = false; }; }; - networking = { hostName = "sakura"; }; @@ -26,7 +26,6 @@ xkbVariant = ""; }; - virtualisation.docker.enable = true; users = { defaultUserShell = pkgs.nushell; users.notoh = { diff --git a/hosts/sutakku/default.nix b/hosts/sutakku/default.nix index 9690d22..1415327 100644 --- a/hosts/sutakku/default.nix +++ b/hosts/sutakku/default.nix @@ -26,7 +26,6 @@ xkbVariant = ""; }; - virtualisation.docker.enable = true; users = { defaultUserShell = pkgs.nushell; users.oh = { diff --git a/modules/default.nix b/modules/default.nix index 2702246..74b8690 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -5,5 +5,6 @@ ./nix.nix ./system.nix ./openssh.nix + ./virtualisation.nix ]; } diff --git a/modules/services/default.nix b/modules/services/default.nix new file mode 100644 index 0000000..bddacc8 --- /dev/null +++ b/modules/services/default.nix @@ -0,0 +1,6 @@ +{...}: { + imports = [ + ./traefik.nix + ./homepage.nix + ]; +} diff --git a/modules/services/homepage.nix b/modules/services/homepage.nix new file mode 100644 index 0000000..da9cb7f --- /dev/null +++ b/modules/services/homepage.nix @@ -0,0 +1,7 @@ +{pkgs, ...}: { + virtualisation.oci-containers.containers.homepage = { + ports = ["3000:3000"]; + image = "ghcr.io/benphelps/homepage"; + volumes = ["/home/notoh/docker/homepage:/app/config" "/var/run/docker.sock:/var/run/docker.sock:ro"]; + }; +} diff --git a/modules/services/traefik.nix b/modules/services/traefik.nix new file mode 100644 index 0000000..d6f25a4 --- /dev/null +++ b/modules/services/traefik.nix @@ -0,0 +1,29 @@ +{...}: { + networking.firewall.allowedTCPPorts = [80 443]; + + services.traefik = { + enable = true; + group = "docker"; + dynamicConfigOptions = { + http = { + routers = { + homepage = { + rule = "Host(`dashboard.lab`)"; + entryPoints = ["websecure"]; + service = "homepage"; + }; + }; + }; + }; + staticConfigOptions = { + global = { + checkNewVersion = false; + sendAnonymousUsage = false; + }; + entryPoints = { + websecure.address = ":443"; + web.address = ":80"; + }; + }; + }; +} diff --git a/modules/virtualisation.nix b/modules/virtualisation.nix new file mode 100644 index 0000000..7ba55dd --- /dev/null +++ b/modules/virtualisation.nix @@ -0,0 +1,16 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [docker-compose]; + + virtualisation.oci-containers.backend = "docker"; + virtualisation.docker = { + enable = true; + enableOnBoot = true; + autoPrune = { + enable = true; + dates = "weekly"; + }; + listenOptions = [ + "/run/docker.sock" + ]; + }; +}