mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2025-12-10 03:49:44 +00:00
Compare commits
4 commits
04d4ac2a9e
...
10516f783a
| Author | SHA1 | Date | |
|---|---|---|---|
| 10516f783a | |||
| cee1c9bc5d | |||
| 431847b59f | |||
| fec6c21498 |
4 changed files with 66 additions and 6 deletions
|
|
@ -52,6 +52,7 @@
|
||||||
source .env
|
source .env
|
||||||
set +a
|
set +a
|
||||||
'' else "";
|
'' else "";
|
||||||
|
stderrToStdout = if sCfg.log.enable then "exec 2>&1" else "";
|
||||||
in
|
in
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
|
|
@ -59,6 +60,7 @@
|
||||||
"runit/services/${serviceName}/run" = {
|
"runit/services/${serviceName}/run" = {
|
||||||
text = ''
|
text = ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
${stderrToStdout}
|
||||||
${envExports}
|
${envExports}
|
||||||
${envFileSetup}
|
${envFileSetup}
|
||||||
${sCfg.script}
|
${sCfg.script}
|
||||||
|
|
@ -70,7 +72,8 @@
|
||||||
"runit/services/${serviceName}/log/run" = lib.mkIf sCfg.log.enable {
|
"runit/services/${serviceName}/log/run" = lib.mkIf sCfg.log.enable {
|
||||||
text = ''
|
text = ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec svlogd -t ./main
|
mkdir -p main
|
||||||
|
exec svlogd -tt ./main
|
||||||
'';
|
'';
|
||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
32
home/modules/runit/services/caddy.nix
Normal file
32
home/modules/runit/services/caddy.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{ pkgs, config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
home.file.".config/caddy/Caddyfile".text = ''
|
||||||
|
{
|
||||||
|
http_port 8080
|
||||||
|
https_port 8443
|
||||||
|
auto_https off
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cloudflare Tunnel
|
||||||
|
http://gist.toast.name {
|
||||||
|
# Opengist
|
||||||
|
reverse_proxy http://localhost:${config.runit.services.opengist.environment.OG_HTTP_PORT}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tailscale
|
||||||
|
http://y2q.ts.toast.name {
|
||||||
|
# Glances
|
||||||
|
reverse_proxy http://localhost:61208
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
runit.services.caddy = {
|
||||||
|
script = ''
|
||||||
|
exec ${pkgs.caddy}/bin/caddy run \
|
||||||
|
--config "$HOME/.config/caddy/Caddyfile" \
|
||||||
|
--adapter caddyfile
|
||||||
|
'';
|
||||||
|
log.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
{ pkgs, config, rootPath, ... }:
|
{ pkgs, config, rootPath, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
tunnel = "cb0d9c2c-48f9-4bca-9e81-ef92423c5afa";
|
tunnel = "cb0d9c2c-48f9-4bca-9e81-ef92423c5afa";
|
||||||
|
subdomains = [
|
||||||
|
"gist.toast.name"
|
||||||
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.file.".cloudflared/${tunnel}.json".source = rootPath + /secrets/gitcrypt/cloudflared/${tunnel}.json;
|
home.file.".cloudflared/${tunnel}.json".source = rootPath + /secrets/gitcrypt/cloudflared/${tunnel}.json;
|
||||||
|
|
@ -11,10 +14,11 @@ in
|
||||||
credentials-file: ${config.home.homeDirectory}/.cloudflared/${tunnel}.json
|
credentials-file: ${config.home.homeDirectory}/.cloudflared/${tunnel}.json
|
||||||
|
|
||||||
ingress:
|
ingress:
|
||||||
- hostname: gist.toast.name
|
${lib.concatMapStringsSep "\n" (host: ''
|
||||||
service: http://${config.runit.services.opengist.environment.OG_HTTP_HOST}:${config.runit.services.opengist.environment.OG_HTTP_PORT}
|
${" "}- hostname: ${host}
|
||||||
|
${" "} service: http://localhost:80
|
||||||
- service: http_status:404
|
'') subdomains}
|
||||||
|
${" "}- service: http_status:404
|
||||||
'';
|
'';
|
||||||
|
|
||||||
runit.services.cloudflared = {
|
runit.services.cloudflared = {
|
||||||
|
|
|
||||||
21
home/modules/runit/services/restic-rest-server.nix
Normal file
21
home/modules/runit/services/restic-rest-server.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
runit.services.restic-rest-server = {
|
||||||
|
script = ''
|
||||||
|
DATA_DIR=$HOME/services/restic-rest-server
|
||||||
|
mkdir -p "$DATA_DIR"
|
||||||
|
|
||||||
|
exec ${pkgs.restic-rest-server}/bin/rest-server \
|
||||||
|
--listen "$LISTEN_ADDR" \
|
||||||
|
--log - \
|
||||||
|
--no-auth \
|
||||||
|
--path $DATA_DIR \
|
||||||
|
--prometheus --prometheus-no-auth
|
||||||
|
'';
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
LISTEN_ADDR = "127.0.0.1:9000";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue