Compare commits
No commits in common. "1767610c7ce98786427d8fa85ef82152db410f3a" and "5353f725a91261558f31a35dee39d0347adf910b" have entirely different histories.
1767610c7c
...
5353f725a9
|
@ -23,7 +23,6 @@
|
|||
./nnn.nix
|
||||
./node.nix
|
||||
./obsidian.nix
|
||||
./redis.nix
|
||||
./slack.nix
|
||||
./spotify.nix
|
||||
./starship.nix
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.profile.services.redis;
|
||||
inherit (lib) mkIf;
|
||||
in
|
||||
lib.mkMerge [
|
||||
(mkIf cfg.client.cli.enable {
|
||||
home.packages = [
|
||||
pkgs.redis
|
||||
];
|
||||
})
|
||||
]
|
|
@ -6,6 +6,5 @@ in
|
|||
options.profile.flatpak = {
|
||||
enable = mkEnableOption "flatpak";
|
||||
zen-browser.enable = mkEnableOption "zen-browser";
|
||||
redisinsight.enable = mkEnableOption "redisinsight";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -35,10 +35,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
redis = {
|
||||
client.cli.enable = mkEnableOption "redis cli client";
|
||||
};
|
||||
|
||||
couchdb.enable = mkEnableOption "couchdb";
|
||||
|
||||
telemetry = {
|
||||
|
|
|
@ -82,7 +82,6 @@ in
|
|||
flatpak = {
|
||||
enable = true;
|
||||
zen-browser.enable = true;
|
||||
redisinsight.enable = true;
|
||||
};
|
||||
|
||||
microsoft-edge.enable = true;
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
navidrome.enable = true;
|
||||
telemetry.enable = true;
|
||||
ntfy-sh.enable = true;
|
||||
ntfy-sh.client.enable = false;
|
||||
couchdb.enable = true;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -13,8 +13,7 @@ in
|
|||
onCalendar = "weekly"; # Default value
|
||||
};
|
||||
packages = [ ]
|
||||
++ optional cfg.zen-browser.enable "io.github.zen_browser.zen"
|
||||
++ optional cfg.redisinsight.enable "com.redis.RedisInsight";
|
||||
++ optional cfg.zen-browser.enable "io.github.zen_browser.zen";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
name = "valheim";
|
||||
podman = config.profile.podman;
|
||||
inherit (lib) mkIf strings;
|
||||
ip = "10.88.200.10";
|
||||
ip-hutasuhut = "10.88.200.11";
|
||||
image = "docker.io/lloesche/valheim-server";
|
||||
domain = "${name}.tigor.web.id";
|
||||
user = config.profile.user;
|
||||
uid = toString user.uid;
|
||||
gid = toString user.gid;
|
||||
base_dir = "/var/lib/${name}";
|
||||
base_dir_hutasuhut = "/var/lib/${name}_hutasuhut";
|
||||
in
|
||||
lib.mkMerge [
|
||||
(mkIf (podman.${name}.enable) {
|
||||
|
@ -41,24 +39,12 @@ lib.mkMerge [
|
|||
'';
|
||||
};
|
||||
|
||||
systemd.tmpfiles.settings."podman-${name}" = {
|
||||
${base_dir}.d = {
|
||||
group = config.profile.user.name;
|
||||
mode = "0755";
|
||||
user = config.profile.user.name;
|
||||
};
|
||||
systemd.tmpfiles.settings."podman-${name}".${base_dir}.d = {
|
||||
group = config.profile.user.name;
|
||||
mode = "0755";
|
||||
user = config.profile.user.name;
|
||||
};
|
||||
|
||||
systemd.tmpfiles.settings."podman-${name}-hutasuhut" = {
|
||||
${base_dir_hutasuhut}.d = {
|
||||
group = config.profile.user.name;
|
||||
mode = "0755";
|
||||
user = config.profile.user.name;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtualisation.oci-containers.containers.${name} =
|
||||
{
|
||||
inherit image;
|
||||
|
@ -66,6 +52,7 @@ lib.mkMerge [
|
|||
autoStart = true;
|
||||
ports = [
|
||||
"2456:2456/udp"
|
||||
"2457:2457/udp"
|
||||
];
|
||||
volumes = [
|
||||
"${base_dir}/config:/config"
|
||||
|
@ -91,38 +78,6 @@ lib.mkMerge [
|
|||
"io.containers.autoupdate" = "registry";
|
||||
};
|
||||
};
|
||||
virtualisation.oci-containers.containers."${name}-hutasuhut" =
|
||||
{
|
||||
inherit image;
|
||||
hostname = name;
|
||||
autoStart = true;
|
||||
ports = [
|
||||
"2457:2457/udp"
|
||||
];
|
||||
volumes = [
|
||||
"${base_dir_hutasuhut}/config:/config"
|
||||
"${base_dir_hutasuhut}/data:/opt/valheim"
|
||||
];
|
||||
environment = {
|
||||
TZ = "Asia/Jakarta";
|
||||
SERVER_NAME = "Hutasuhut";
|
||||
WORLD_NAME = "Hutasuhut";
|
||||
STATUS_HTTP = "true";
|
||||
PUID = uid;
|
||||
PGID = gid;
|
||||
};
|
||||
extraOptions = [
|
||||
"--network=podman"
|
||||
"--ip=${ip-hutasuhut}"
|
||||
"--cap-add=sys_nice"
|
||||
];
|
||||
environmentFiles = [
|
||||
config.sops.templates."valheim-env".path
|
||||
];
|
||||
labels = {
|
||||
"io.containers.autoupdate" = "registry";
|
||||
};
|
||||
};
|
||||
})
|
||||
{
|
||||
profile.services.ntfy-sh.client.settings.subscribe = [
|
||||
|
@ -131,11 +86,4 @@ lib.mkMerge [
|
|||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
profile.services.ntfy-sh.client.settings.subscribe = [
|
||||
{
|
||||
topic = "valheim-hutasuhut";
|
||||
}
|
||||
];
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, unstable, ... }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.profile.services.caddy;
|
||||
inherit (lib) mkIf attrsets strings lists;
|
||||
|
@ -7,7 +7,6 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
package = unstable.caddy;
|
||||
};
|
||||
|
||||
services.caddy.globalConfig = /*caddy*/ ''
|
||||
|
@ -16,44 +15,36 @@ in
|
|||
}
|
||||
'';
|
||||
|
||||
environment.etc."caddy/static/tigor.web.id/index.html" = {
|
||||
text =
|
||||
let
|
||||
domains = attrsets.mapAttrsToList (name: _: strings.removePrefix "https://" name) config.services.caddy.virtualHosts;
|
||||
sortedDomains = lists.sort (a: b: a < b) domains;
|
||||
list = map
|
||||
(domain: /*html*/ ''
|
||||
<div class="col-12 col-sm-6 col-md-4 col-lg-3 text-center align-middle">
|
||||
<a href="https://${domain}">${domain}</a>
|
||||
</div>
|
||||
'')
|
||||
sortedDomains;
|
||||
items = strings.concatStringsSep "\n" list;
|
||||
in
|
||||
/*html*/ ''
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hosted Sites</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||
crossorigin="anonymous">
|
||||
</head>
|
||||
<body class="container">
|
||||
<h1 class="text-center">Hosted Sites</h1>
|
||||
<div class="row g-4">
|
||||
${items}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
'';
|
||||
user = "caddy";
|
||||
group = "caddy";
|
||||
};
|
||||
|
||||
services.caddy.virtualHosts =
|
||||
let
|
||||
domains = attrsets.mapAttrsToList (name: _: strings.removePrefix "https://" name) config.services.caddy.virtualHosts;
|
||||
sortedDomains = lists.sort (a: b: a < b) domains;
|
||||
list = map
|
||||
(domain: /*html*/ ''
|
||||
<div class="col-12 col-sm-6 col-md-4 col-lg-3 text-center align-middle">
|
||||
<a href="https://${domain}">${domain}</a>
|
||||
</div>'')
|
||||
sortedDomains;
|
||||
items = strings.concatStringsSep "\n" list;
|
||||
html = /*html*/
|
||||
''<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hosted Sites</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||
crossorigin="anonymous">
|
||||
</head>
|
||||
<body class="container">
|
||||
<h1 class="text-center">Hosted Sites</h1>
|
||||
<div class="row g-4">
|
||||
${items}
|
||||
</div>
|
||||
</body>
|
||||
</html>'';
|
||||
in
|
||||
{
|
||||
"router.tigor.web.id".extraConfig = ''
|
||||
@denied not remote_ip private_ranges
|
||||
|
@ -64,13 +55,17 @@ in
|
|||
'';
|
||||
"tigor.web.id".extraConfig =
|
||||
''
|
||||
root * /etc/caddy/static/tigor.web.id
|
||||
file_server
|
||||
header Content-Type text/html
|
||||
respond <<EOF
|
||||
${html}
|
||||
EOF 200
|
||||
'';
|
||||
"crowfx.web.id".extraConfig =
|
||||
''
|
||||
root * /etc/caddy/static/tigor.web.id
|
||||
file_server
|
||||
header Content-Type text/html
|
||||
respond <<EOF
|
||||
${html}
|
||||
EOF 200
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue