Compare commits

..

No commits in common. "1767610c7ce98786427d8fa85ef82152db410f3a" and "5353f725a91261558f31a35dee39d0347adf910b" have entirely different histories.

9 changed files with 45 additions and 123 deletions

View file

@ -23,7 +23,6 @@
./nnn.nix ./nnn.nix
./node.nix ./node.nix
./obsidian.nix ./obsidian.nix
./redis.nix
./slack.nix ./slack.nix
./spotify.nix ./spotify.nix
./starship.nix ./starship.nix

View file

@ -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
];
})
]

View file

@ -6,6 +6,5 @@ in
options.profile.flatpak = { options.profile.flatpak = {
enable = mkEnableOption "flatpak"; enable = mkEnableOption "flatpak";
zen-browser.enable = mkEnableOption "zen-browser"; zen-browser.enable = mkEnableOption "zen-browser";
redisinsight.enable = mkEnableOption "redisinsight";
}; };
} }

View file

@ -35,10 +35,6 @@ in
}; };
}; };
redis = {
client.cli.enable = mkEnableOption "redis cli client";
};
couchdb.enable = mkEnableOption "couchdb"; couchdb.enable = mkEnableOption "couchdb";
telemetry = { telemetry = {

View file

@ -82,7 +82,6 @@ in
flatpak = { flatpak = {
enable = true; enable = true;
zen-browser.enable = true; zen-browser.enable = true;
redisinsight.enable = true;
}; };
microsoft-edge.enable = true; microsoft-edge.enable = true;

View file

@ -68,7 +68,6 @@
navidrome.enable = true; navidrome.enable = true;
telemetry.enable = true; telemetry.enable = true;
ntfy-sh.enable = true; ntfy-sh.enable = true;
ntfy-sh.client.enable = false;
couchdb.enable = true; couchdb.enable = true;
}; };
}; };

View file

@ -13,8 +13,7 @@ in
onCalendar = "weekly"; # Default value onCalendar = "weekly"; # Default value
}; };
packages = [ ] packages = [ ]
++ optional cfg.zen-browser.enable "io.github.zen_browser.zen" ++ optional cfg.zen-browser.enable "io.github.zen_browser.zen";
++ optional cfg.redisinsight.enable "com.redis.RedisInsight";
}; };
}; };
} }

View file

@ -1,17 +1,15 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
name = "valheim"; name = "valheim";
podman = config.profile.podman; podman = config.profile.podman;
inherit (lib) mkIf strings; inherit (lib) mkIf strings;
ip = "10.88.200.10"; ip = "10.88.200.10";
ip-hutasuhut = "10.88.200.11";
image = "docker.io/lloesche/valheim-server"; image = "docker.io/lloesche/valheim-server";
domain = "${name}.tigor.web.id"; domain = "${name}.tigor.web.id";
user = config.profile.user; user = config.profile.user;
uid = toString user.uid; uid = toString user.uid;
gid = toString user.gid; gid = toString user.gid;
base_dir = "/var/lib/${name}"; base_dir = "/var/lib/${name}";
base_dir_hutasuhut = "/var/lib/${name}_hutasuhut";
in in
lib.mkMerge [ lib.mkMerge [
(mkIf (podman.${name}.enable) { (mkIf (podman.${name}.enable) {
@ -41,24 +39,12 @@ lib.mkMerge [
''; '';
}; };
systemd.tmpfiles.settings."podman-${name}" = { systemd.tmpfiles.settings."podman-${name}".${base_dir}.d = {
${base_dir}.d = { group = config.profile.user.name;
group = config.profile.user.name; mode = "0755";
mode = "0755"; user = config.profile.user.name;
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} = virtualisation.oci-containers.containers.${name} =
{ {
inherit image; inherit image;
@ -66,6 +52,7 @@ lib.mkMerge [
autoStart = true; autoStart = true;
ports = [ ports = [
"2456:2456/udp" "2456:2456/udp"
"2457:2457/udp"
]; ];
volumes = [ volumes = [
"${base_dir}/config:/config" "${base_dir}/config:/config"
@ -91,38 +78,6 @@ lib.mkMerge [
"io.containers.autoupdate" = "registry"; "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 = [ profile.services.ntfy-sh.client.settings.subscribe = [
@ -131,11 +86,4 @@ lib.mkMerge [
} }
]; ];
} }
{
profile.services.ntfy-sh.client.settings.subscribe = [
{
topic = "valheim-hutasuhut";
}
];
}
] ]

View file

@ -1,4 +1,4 @@
{ config, lib, unstable, ... }: { config, lib, ... }:
let let
cfg = config.profile.services.caddy; cfg = config.profile.services.caddy;
inherit (lib) mkIf attrsets strings lists; inherit (lib) mkIf attrsets strings lists;
@ -7,7 +7,6 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.caddy = { services.caddy = {
enable = true; enable = true;
package = unstable.caddy;
}; };
services.caddy.globalConfig = /*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 = 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 = '' "router.tigor.web.id".extraConfig = ''
@denied not remote_ip private_ranges @denied not remote_ip private_ranges
@ -64,13 +55,17 @@ in
''; '';
"tigor.web.id".extraConfig = "tigor.web.id".extraConfig =
'' ''
root * /etc/caddy/static/tigor.web.id header Content-Type text/html
file_server respond <<EOF
${html}
EOF 200
''; '';
"crowfx.web.id".extraConfig = "crowfx.web.id".extraConfig =
'' ''
root * /etc/caddy/static/tigor.web.id header Content-Type text/html
file_server respond <<EOF
${html}
EOF 200
''; '';
}; };