-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
73 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,33 +5,16 @@ let | |
inherit (inputs) self; | ||
in | ||
{ | ||
# nixos-unified.sshTarget = "[email protected]"; | ||
nixos-unified.sshTarget = "gate"; | ||
|
||
imports = [ | ||
./configuration.nix | ||
(self + /modules/nixos/shared/primary-as-admin.nix) | ||
(self + /webapps/proxy.nix) | ||
]; | ||
|
||
nixpkgs.hostPlatform = "x86_64-linux"; | ||
services.tailscale.enable = true; | ||
services.openssh.settings.PasswordAuthentication = false; | ||
services.nginx = { | ||
enable = true; | ||
recommendedProxySettings = true; | ||
recommendedTlsSettings = true; | ||
virtualHosts."actualism.app" = { | ||
# FIXME: Don't hardcode, instead of read from pureintent's containers.nix | ||
locations."/".proxyPass = "http://pureintent:3000"; | ||
enableACME = true; | ||
addSSL = true; | ||
}; | ||
}; | ||
security.acme = { | ||
acceptTerms = true; | ||
defaults.email = "[email protected]"; | ||
}; | ||
networking.firewall.allowedTCPPorts = [ 80 443 22 ]; | ||
|
||
# Workaround the annoying `Failed to start Network Manager Wait Online` error on switch. | ||
# https://github.com/NixOS/nixpkgs/issues/180175 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Hosting webapps on home-server | ||
|
||
Host them on `pureintent` (home-server) | ||
|
||
Run nginx on `gate` (Hetzner VPS). | ||
|
||
Put the two in a Tailscale network. Profit! | ||
|
||
WARNING: This is not cleanly designed yet, so don't use it as a reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ flake, system, ... }: | ||
{ | ||
actualism-app = { | ||
port = 3000; # TODO: Change this, and pass to daemon (renaming `package` to `exec` or something) | ||
domain = "actualism.app"; | ||
package = flake.inputs.actualism-app.packages.${system}.default; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Configuration for the host on which all webapps will run. | ||
{ flake, pkgs, lib, ... }: | ||
|
||
let | ||
webapps = import ./. { inherit flake; system = pkgs.system; }; | ||
in | ||
{ | ||
# Run each web app as a systemd service decided inside a container. | ||
containers = lib.mapAttrs | ||
(name: v: { | ||
autoStart = true; | ||
config = { | ||
systemd.services.${name} = { | ||
description = name; | ||
wantedBy = [ "multi-user.target" ]; | ||
serviceConfig = { | ||
ExecStart = "${lib.getExe v.package}"; | ||
Restart = "always"; | ||
}; | ||
}; | ||
}; | ||
}) | ||
webapps; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Configuration for the VPS running nginx reverse proxy | ||
{ flake, pkgs, lib, webapps, ... }: | ||
|
||
let | ||
host = "pureintent"; # See host.nix | ||
webapps = import ./. { inherit flake; system = pkgs.system; }; | ||
in | ||
{ | ||
services.tailscale.enable = true; | ||
|
||
services.nginx = { | ||
enable = true; | ||
recommendedProxySettings = true; | ||
recommendedTlsSettings = true; | ||
|
||
virtualHosts = lib.mapAttrs' | ||
(name: v: lib.nameValuePair v.domain { | ||
locations."/".proxyPass = "http://${host}:${builtins.toString v.port}"; | ||
enableACME = true; | ||
addSSL = true; | ||
}) | ||
webapps; | ||
}; | ||
|
||
security.acme = { | ||
acceptTerms = true; | ||
defaults.email = "[email protected]"; | ||
}; | ||
networking.firewall.allowedTCPPorts = [ 80 443 22 ]; | ||
} |