mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2026-01-31 08:30:25 +00:00
chore(y2q): remove runit
- Remove runit module and services - Remove git-crypt (no longer needed) The services are moved to https://github.com/lightly-toasted/homelab-ansible
This commit is contained in:
parent
efd61adc07
commit
210143a6c4
14 changed files with 0 additions and 253 deletions
|
|
@ -88,7 +88,6 @@
|
||||||
pkgs.home-manager
|
pkgs.home-manager
|
||||||
pkgs.sops
|
pkgs.sops
|
||||||
pkgs.git
|
pkgs.git
|
||||||
pkgs.git-crypt
|
|
||||||
pkgs.just
|
pkgs.just
|
||||||
pkgs.nh
|
pkgs.nh
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nixvim.homeModules.nixvim
|
inputs.nixvim.homeModules.nixvim
|
||||||
|
|
||||||
../modules/runit
|
|
||||||
../modules/cli/git.nix
|
../modules/cli/git.nix
|
||||||
../modules/cli/ripgrep.nix
|
../modules/cli/ripgrep.nix
|
||||||
../modules/cli/btop.nix
|
../modules/cli/btop.nix
|
||||||
|
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = (
|
|
||||||
let
|
|
||||||
servicesPath = ./services;
|
|
||||||
serviceModules = builtins.attrNames (builtins.readDir (servicesPath));
|
|
||||||
in
|
|
||||||
map (module: servicesPath + "/${module}") serviceModules
|
|
||||||
);
|
|
||||||
|
|
||||||
options.runit = {
|
|
||||||
services = lib.mkOption {
|
|
||||||
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
|
|
||||||
options = {
|
|
||||||
script = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "Shell commands executed as the service's main process";
|
|
||||||
};
|
|
||||||
log.enable = lib.mkEnableOption "Enable logging";
|
|
||||||
environment = lib.mkOption {
|
|
||||||
type = lib.types.attrsOf lib.types.str;
|
|
||||||
default = {};
|
|
||||||
description = "Environment variables passed to the service's processes";
|
|
||||||
};
|
|
||||||
environmentFile = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.path;
|
|
||||||
default = null;
|
|
||||||
description = "Environment file passed to the service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
default = {};
|
|
||||||
description = "User-level runit services under ~/runit/services/";
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
home.file = lib.mkMerge (
|
|
||||||
lib.mapAttrsToList (serviceName: sCfg:
|
|
||||||
let
|
|
||||||
envExports = lib.concatStringsSep "\n" (
|
|
||||||
lib.mapAttrsToList (k: v: "export ${k}='${v}'") sCfg.environment
|
|
||||||
);
|
|
||||||
envFile = lib.mkIf (sCfg.environmentFile != null) {
|
|
||||||
"runit/services/${serviceName}/.env" = {
|
|
||||||
source = sCfg.environmentFile;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
envFileSetup = if sCfg.environmentFile != null then ''
|
|
||||||
set -a
|
|
||||||
source .env
|
|
||||||
set +a
|
|
||||||
'' else "";
|
|
||||||
stderrToStdout = if sCfg.log.enable then "exec 2>&1" else "";
|
|
||||||
in
|
|
||||||
lib.mkMerge [
|
|
||||||
{
|
|
||||||
# run script
|
|
||||||
"runit/services/${serviceName}/run" = {
|
|
||||||
text = ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
${stderrToStdout}
|
|
||||||
${envExports}
|
|
||||||
${envFileSetup}
|
|
||||||
${sCfg.script}
|
|
||||||
'';
|
|
||||||
executable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# logging
|
|
||||||
"runit/services/${serviceName}/log/run" = lib.mkIf sCfg.log.enable {
|
|
||||||
text = ''
|
|
||||||
#!/bin/sh
|
|
||||||
mkdir -p main
|
|
||||||
exec svlogd -tt ./main
|
|
||||||
'';
|
|
||||||
executable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
envFile
|
|
||||||
]
|
|
||||||
) config.runit.services
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
{ 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
|
|
||||||
}
|
|
||||||
|
|
||||||
http://grafana.ts.toast.name {
|
|
||||||
# Grafana
|
|
||||||
reverse_proxy http://localhost:${config.runit.services.grafana.environment.GF_SERVER_HTTP_PORT}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
runit.services.caddy = {
|
|
||||||
script = ''
|
|
||||||
exec ${pkgs.caddy}/bin/caddy run \
|
|
||||||
--config "$HOME/.config/caddy/Caddyfile" \
|
|
||||||
--adapter caddyfile
|
|
||||||
'';
|
|
||||||
log.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
{ pkgs, config, rootPath, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
tunnel = "cb0d9c2c-48f9-4bca-9e81-ef92423c5afa";
|
|
||||||
subdomains = [
|
|
||||||
"gist.toast.name"
|
|
||||||
];
|
|
||||||
in
|
|
||||||
{
|
|
||||||
home.file.".cloudflared/${tunnel}.json".source = rootPath + /secrets/gitcrypt/cloudflared/${tunnel}.json;
|
|
||||||
home.file.".cloudflared/cert.pem".source = rootPath + /secrets/gitcrypt/cloudflared/cert.pem;
|
|
||||||
home.file.".cloudflared/config.yml".text = ''
|
|
||||||
tunnel: ${tunnel}
|
|
||||||
credentials-file: ${config.home.homeDirectory}/.cloudflared/${tunnel}.json
|
|
||||||
|
|
||||||
ingress:
|
|
||||||
${lib.concatMapStringsSep "\n" (host: ''
|
|
||||||
${" "}- hostname: ${host}
|
|
||||||
${" "} service: http://localhost:80
|
|
||||||
'') subdomains}
|
|
||||||
${" "}- service: http_status:404
|
|
||||||
'';
|
|
||||||
|
|
||||||
runit.services.cloudflared = {
|
|
||||||
script = ''
|
|
||||||
exec ${pkgs.cloudflared}/bin/cloudflared tunnel run
|
|
||||||
'';
|
|
||||||
log.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
runit.services.glances = {
|
|
||||||
script = ''
|
|
||||||
exec ${pkgs.glances}/bin/glances -w
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
runit.services.grafana = {
|
|
||||||
script = ''
|
|
||||||
HOME_PATH=$HOME/services/grafana
|
|
||||||
mkdir -p "$HOME_PATH"
|
|
||||||
|
|
||||||
exec ${pkgs.grafana}/bin/grafana server \
|
|
||||||
--homepath ${pkgs.grafana}/share/grafana
|
|
||||||
'';
|
|
||||||
|
|
||||||
environment = {
|
|
||||||
GF_SERVER_HTTP_ADDR = "127.0.0.1";
|
|
||||||
GF_SERVER_HTTP_PORT = "3000";
|
|
||||||
GF_PATHS_DATA = "${config.home.homeDirectory}/services/grafana";
|
|
||||||
};
|
|
||||||
|
|
||||||
log.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
{ pkgs, rootPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
runit.services.opengist = {
|
|
||||||
script = ''
|
|
||||||
exec ${pkgs.opengist}/bin/opengist start
|
|
||||||
'';
|
|
||||||
|
|
||||||
environment = {
|
|
||||||
OG_HTTP_HOST = "127.0.0.1";
|
|
||||||
OG_HTTP_PORT = "6157";
|
|
||||||
OG_SSH_HOST = "127.0.0.1";
|
|
||||||
OG_SSH_PORT = "6522";
|
|
||||||
};
|
|
||||||
|
|
||||||
environmentFile = rootPath + /secrets/gitcrypt/opengist.env;
|
|
||||||
|
|
||||||
log.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{ pkgs, config, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
home.file.".config/prometheus/prometheus.yml".text = ''
|
|
||||||
global:
|
|
||||||
scrape_interval: 1m
|
|
||||||
|
|
||||||
scrape_configs:
|
|
||||||
- job_name: 'restic_rest_server'
|
|
||||||
static_configs:
|
|
||||||
- targets: ['${config.runit.services.restic-rest-server.environment.LISTEN_ADDR}']
|
|
||||||
'';
|
|
||||||
|
|
||||||
runit.services.prometheus = {
|
|
||||||
script = ''
|
|
||||||
TSDB_PATH=$HOME/services/prometheus
|
|
||||||
mkdir -p TSDB_PATH
|
|
||||||
|
|
||||||
exec ${pkgs.prometheus}/bin/prometheus \
|
|
||||||
--config.file=$HOME/.config/prometheus/prometheus.yml \
|
|
||||||
--storage.tsdb.path=$TSDB_PATH \
|
|
||||||
--web.listen-address="127.0.0.1:9090"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{ 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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -6,7 +6,6 @@ pkgs.mkShell {
|
||||||
home-manager
|
home-manager
|
||||||
git
|
git
|
||||||
sops
|
sops
|
||||||
git-crypt
|
|
||||||
just
|
just
|
||||||
nh
|
nh
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue