Make it work
This commit is contained in:
parent
02989b844d
commit
5919f10719
2 changed files with 63 additions and 27 deletions
|
@ -1,41 +1,65 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
let enableACME = false;
|
||||||
|
port = toString 3000;
|
||||||
|
in {
|
||||||
|
|
||||||
security.acme = {
|
security.acme = {
|
||||||
acceptTerms = true;
|
acceptTerms = true;
|
||||||
email = "me@riley.lgbt";
|
defaults.email = "me@riley.lgbt";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.enable = true;
|
services.nginx.enable = true;
|
||||||
services.nginx.virtualHosts = {
|
services.nginx.virtualHosts = {
|
||||||
|
|
||||||
|
"192.168.2.22" = {
|
||||||
|
listen = [{
|
||||||
|
port = 80;
|
||||||
|
addr = "192.168.2.22";
|
||||||
|
}];
|
||||||
|
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:${port}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Main domain that hosts my website
|
||||||
"riley.lgbt" = {
|
"riley.lgbt" = {
|
||||||
|
|
||||||
|
inherit enableACME;
|
||||||
|
|
||||||
listen = [{
|
listen = [{
|
||||||
port = 443;
|
port = if enableACME then 443 else 80;
|
||||||
addr = "77.169.117.112";
|
addr = "77.169.117.112";
|
||||||
}];
|
}];
|
||||||
enableACME = true;
|
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://localhost:3000";
|
proxyPass = "http://localhost:${port}";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
"rly.cx" = {
|
"rly.cx" = {
|
||||||
|
|
||||||
|
inherit enableACME;
|
||||||
|
|
||||||
listen = [{
|
listen = [{
|
||||||
port = 443;
|
port = if enableACME then 443 else 80;
|
||||||
addr = "77.169.117.112";
|
addr = "77.169.117.112";
|
||||||
}];
|
}];
|
||||||
enableACME = true;
|
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://localhost:3000";
|
proxyPass = "http://localhost:${port}";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,28 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
let secret = config.age.secrets."website".path;
|
let secret = config.age.secrets."website".path;
|
||||||
website = pkgs.rustPlatform.buildRustPackage {
|
builder = pkgs.rustPlatform.buildRustPackage.override {
|
||||||
|
rustc = (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal)).overrideAttrs (old: {
|
||||||
|
meta.platforms = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
website = builder {
|
||||||
pname = "website";
|
pname = "website";
|
||||||
version = "1.0.0";
|
version = "0.1.0";
|
||||||
cargoSha256 = "sha256-sT5BONGXWCpc+455TS1rc/SwNUtc6hXbwUMO/q/tiJ0=";
|
cargoSha256 = "sha256-4v45QaZKyjifn2MGyuy+SovfFBWu55FYR9nWRWlaQOM=";
|
||||||
|
|
||||||
postPatch = ''
|
postInstall = ''
|
||||||
cp ${secret} secret
|
cp ./links.toml $out/links.toml
|
||||||
|
cp -r ./static/ $out/static/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
src = pkgs.fetchgit {
|
src = pkgs.fetchgit {
|
||||||
url = "https://im.badat.dev/riley/website.git";
|
url = "https://im.badat.dev/riley/website.git";
|
||||||
rev = "refs/heads/mistress";
|
rev = "refs/heads/mistress";
|
||||||
sha256 = "sha256-NiFinpSOE1wokOgBmgpZfMqR9AsENA9t/N84c/Ms2vU=";
|
sha256 = "sha256-QONZR4zpgifEQByH3rtfkHQjwQVrjRy89RVvVLMciKs=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -21,6 +30,9 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "Run my website :)";
|
description = "Run my website :)";
|
||||||
path = [ website ];
|
path = [ website ];
|
||||||
script = "${website}/bin/website";
|
script = ''
|
||||||
|
cd ${website}
|
||||||
|
SITE_API_SECRET=$(cat ${secret}) ${website}/bin/website
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue