diff --git a/configuration.nix b/configuration.nix index 20259aa..0afddfa 100644 --- a/configuration.nix +++ b/configuration.nix @@ -42,6 +42,7 @@ ./system-modules/ydotool.nix ]) ++ (if (host == "NxACE") then [ ./system-modules/nx2site.nix + ./system-modules/hugo.nix ./system-modules/postgres.nix ./system-modules/nx2site/proxy.nix ./system-modules/nx2site/audiobookshelf.nix diff --git a/home-modules/hugo.nix b/home-modules/hugo.nix deleted file mode 100644 index d2f30f6..0000000 --- a/home-modules/hugo.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - hugo - dart-sass - ]; -} diff --git a/home.nix b/home.nix index 7e1e70e..52a9bec 100644 --- a/home.nix +++ b/home.nix @@ -62,7 +62,6 @@ ./home-modules/zathura.nix ./home-modules/zoxide.nix ] ++ (if (host == "NxACE") then [ - ./home-modules/hugo.nix ./home-modules/nx2site.nix ./home-modules/nx2site-backup.nix ] else []); diff --git a/system-modules/hugo.nix b/system-modules/hugo.nix new file mode 100644 index 0000000..713662a --- /dev/null +++ b/system-modules/hugo.nix @@ -0,0 +1,32 @@ +{ pkgs-unstable, user, ... }: +let p = pkgs-unstable; in +{ + environment.systemPackages = with p; [ + hugo + dart-sass + ]; + + users = { + groups = { + "hugo".name = "hugo"; + }; + users = { + "${user}".extraGroups = [ "hugo" ]; + "nginx".extraGroups = [ "hugo" ]; + "hugo" = { + isSystemUser = true; + group = "hugo"; + }; + }; + }; + + systemd.services."hugo" = { + script = with p; /* shell */ '' + ${hugo}/bin/hugo serve --port 8000 --bind 10.0.1.1 --baseURL http://10.0.1.1:8000 -s /var/lib/hugo/nx2site/ + ''; + serviceConfig = { + Type = "simple"; + User = "hugo"; + }; + }; +} diff --git a/system-modules/nx2site/proxy.nix b/system-modules/nx2site/proxy.nix index fe6b9cb..a8e85ec 100644 --- a/system-modules/nx2site/proxy.nix +++ b/system-modules/nx2site/proxy.nix @@ -14,7 +14,7 @@ }; certs = { "${domain}" = { - extraDomainNames = builtins.map (subd: "${subd}.${domain}") [ "sync" ]; + extraDomainNames = builtins.map (subd: "${subd}.${domain}") [ "sync" "dev" ]; }; }; }; @@ -145,10 +145,21 @@ # }; "abs.${domain}" = vh // { listen = dl; - locations = { "/" = { + locations."/" = { proxyPass = "http://127.0.0.1:${builtins.toString config.services.audiobookshelf.port}"; proxyWebsockets = true; - }; }; + }; + }; + "dev.${domain}" = vh // { + listen = dl ++ [ + # { addr = "0.0.0.0"; port = 8000; ssl = true; } + # { addr = "[::0]"; port = 8000; ssl = true; } + ]; + root = "/var/lib/hugo/nx2site/public"; + # locations."/" = { + # proxyPass = "http://127.0.0.1:8000"; + # proxyWebsockets = true; + # }; }; # is done atomatically # "cal.${domain}" = vh // {