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 = {
|
||||
acceptTerms = true;
|
||||
email = "me@riley.lgbt";
|
||||
defaults.email = "me@riley.lgbt";
|
||||
};
|
||||
|
||||
services.nginx.enable = true;
|
||||
services.nginx.virtualHosts = {
|
||||
"riley.lgbt" = {
|
||||
listen = [{
|
||||
port = 443;
|
||||
addr = "77.169.117.112";
|
||||
}];
|
||||
enableACME = true;
|
||||
|
||||
"192.168.2.22" = {
|
||||
listen = [{
|
||||
port = 80;
|
||||
addr = "192.168.2.22";
|
||||
}];
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:3000";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
'';
|
||||
proxyPass = "http://localhost:${port}";
|
||||
};
|
||||
};
|
||||
"rly.cx" = {
|
||||
|
||||
# Main domain that hosts my website
|
||||
"riley.lgbt" = {
|
||||
|
||||
inherit enableACME;
|
||||
|
||||
listen = [{
|
||||
port = 443;
|
||||
port = if enableACME then 443 else 80;
|
||||
addr = "77.169.117.112";
|
||||
}];
|
||||
enableACME = true;
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:3000";
|
||||
proxyPass = "http://localhost:${port}";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
"rly.cx" = {
|
||||
|
||||
inherit enableACME;
|
||||
|
||||
listen = [{
|
||||
port = if enableACME then 443 else 80;
|
||||
addr = "77.169.117.112";
|
||||
}];
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${port}";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,19 +1,28 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
let secret = config.age.secrets."website".path;
|
||||
website = pkgs.rustPlatform.buildRustPackage {
|
||||
let secret = config.age.secrets."website".path;
|
||||
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";
|
||||
version = "1.0.0";
|
||||
cargoSha256 = "sha256-sT5BONGXWCpc+455TS1rc/SwNUtc6hXbwUMO/q/tiJ0=";
|
||||
version = "0.1.0";
|
||||
cargoSha256 = "sha256-4v45QaZKyjifn2MGyuy+SovfFBWu55FYR9nWRWlaQOM=";
|
||||
|
||||
postPatch = ''
|
||||
cp ${secret} secret
|
||||
'';
|
||||
postInstall = ''
|
||||
cp ./links.toml $out/links.toml
|
||||
cp -r ./static/ $out/static/
|
||||
'';
|
||||
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://im.badat.dev/riley/website.git";
|
||||
rev = "refs/heads/mistress";
|
||||
sha256 = "sha256-NiFinpSOE1wokOgBmgpZfMqR9AsENA9t/N84c/Ms2vU=";
|
||||
sha256 = "sha256-QONZR4zpgifEQByH3rtfkHQjwQVrjRy89RVvVLMciKs=";
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -21,6 +30,9 @@ in {
|
|||
enable = true;
|
||||
description = "Run my website :)";
|
||||
path = [ website ];
|
||||
script = "${website}/bin/website";
|
||||
script = ''
|
||||
cd ${website}
|
||||
SITE_API_SECRET=$(cat ${secret}) ${website}/bin/website
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue