add freshrss to hetzner-arm, add nix-output-monitor to default profile
This commit is contained in:
parent
4f6c49ab5c
commit
ace4e0950f
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
result
|
result
|
||||||
*.qcow2
|
*.qcow2
|
||||||
*~x
|
*~x
|
||||||
|
.direnv
|
55
hosts/hetzner-arm/containers/rss/default.nix
Normal file
55
hosts/hetzner-arm/containers/rss/default.nix
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
hostPath,
|
||||||
|
tree,
|
||||||
|
inputs,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
containerAddresses = import "${hostPath}/data/containerAddresses.nix";
|
||||||
|
hostIP = containerAddresses.host;
|
||||||
|
containerIP = containerAddresses.containers.rss;
|
||||||
|
in {
|
||||||
|
containers.rss = {
|
||||||
|
autoStart = true;
|
||||||
|
privateNetwork = true;
|
||||||
|
hostAddress = hostIP;
|
||||||
|
localAddress = containerIP;
|
||||||
|
|
||||||
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
inherit tree;
|
||||||
|
inherit self;
|
||||||
|
inherit hostPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {...}: {
|
||||||
|
nixpkgs.pkgs = pkgs;
|
||||||
|
|
||||||
|
imports = with tree;
|
||||||
|
[
|
||||||
|
presets.nixos.containerBase
|
||||||
|
./secrets.nix
|
||||||
|
]
|
||||||
|
++ (with hosts.hetzner-arm.containers.rss.profiles; [
|
||||||
|
freshrss
|
||||||
|
restic
|
||||||
|
]);
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [80];
|
||||||
|
|
||||||
|
home-manager.users.root.home.stateVersion = "23.05";
|
||||||
|
system.stateVersion = "23.05";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."freshrss.owo.monster" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".proxyPass = "http://${containerIP}:80";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
11
hosts/hetzner-arm/containers/rss/profiles/freshrss.nix
Normal file
11
hosts/hetzner-arm/containers/rss/profiles/freshrss.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{config, ...}: let
|
||||||
|
inherit (config.services.secrets) secrets;
|
||||||
|
in {
|
||||||
|
services.freshrss = {
|
||||||
|
enable = true;
|
||||||
|
defaultUser = "chaos";
|
||||||
|
baseUrl = "https://freshrss.owo.monster";
|
||||||
|
virtualHost = "127.0.0.1";
|
||||||
|
passwordFile = secrets.chaos_password.path;
|
||||||
|
};
|
||||||
|
}
|
35
hosts/hetzner-arm/containers/rss/profiles/restic.nix
Normal file
35
hosts/hetzner-arm/containers/rss/profiles/restic.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
backupSchedules = import "${self}/data/backupSchedules.nix";
|
||||||
|
inherit (config.services.secrets) secrets;
|
||||||
|
in {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
restic
|
||||||
|
(pkgs.writeShellScriptBin "restic-rss" ''
|
||||||
|
env \
|
||||||
|
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
|
||||||
|
$(cat ${secrets.restic_env.path}) \
|
||||||
|
${pkgs.restic}/bin/restic $@
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
|
services.restic.backups.rss = {
|
||||||
|
user = "root";
|
||||||
|
paths = [
|
||||||
|
"/var/lib/freshrss"
|
||||||
|
];
|
||||||
|
|
||||||
|
# repository is overrided in environmentFile to contain auth
|
||||||
|
# make sure to keep up to date when changing repository
|
||||||
|
repository = "rest:https://storage-restic.owo.monster/RSS";
|
||||||
|
passwordFile = "${secrets.restic_password.path}";
|
||||||
|
environmentFile = "${secrets.restic_env.path}";
|
||||||
|
|
||||||
|
pruneOpts = ["--keep-last 50"];
|
||||||
|
timerConfig = backupSchedules.restic.high;
|
||||||
|
};
|
||||||
|
}
|
49
hosts/hetzner-arm/containers/rss/secrets.nix
Normal file
49
hosts/hetzner-arm/containers/rss/secrets.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
services.secrets = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
apacheHttpd
|
||||||
|
];
|
||||||
|
|
||||||
|
vaultLogin = {
|
||||||
|
enable = true;
|
||||||
|
loginUsername = "hetzner-arm-container-rss";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoSecrets = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
requiredVaultPaths = [
|
||||||
|
"passwords/data/freshrss"
|
||||||
|
|
||||||
|
"api-keys/data/storage/restic/RSS"
|
||||||
|
"private-public-keys/data/restic/RSS"
|
||||||
|
];
|
||||||
|
|
||||||
|
secrets = {
|
||||||
|
vault_password = {
|
||||||
|
manual = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
chaos_password = {
|
||||||
|
fetchScript = ''
|
||||||
|
simple_get "/passwords/freshrss" .password > "$secretFile"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
restic_password = {
|
||||||
|
fetchScript = ''
|
||||||
|
simple_get "/private-public-keys/restic/RSS" .password > "$secretFile"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
restic_env = {
|
||||||
|
fetchScript = ''
|
||||||
|
RESTIC_PASSWORD=$(simple_get "/api-keys/storage/restic/RSS" .restic)
|
||||||
|
echo "RESTIC_REPOSITORY=rest:https://restic:$RESTIC_PASSWORD@storage-restic.owo.monster/TSS" > "$secretFile"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -11,5 +11,6 @@
|
||||||
owncast = "10.0.1.9";
|
owncast = "10.0.1.9";
|
||||||
jellyfin = "10.0.1.10";
|
jellyfin = "10.0.1.10";
|
||||||
grocy = "10.0.1.11";
|
grocy = "10.0.1.11";
|
||||||
|
rss = "10.0.1.12";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ in {
|
||||||
"owncast"
|
"owncast"
|
||||||
"jellyfin"
|
"jellyfin"
|
||||||
"grocy"
|
"grocy"
|
||||||
|
"rss"
|
||||||
] (name: ./containers + "/${name}"))
|
] (name: ./containers + "/${name}"))
|
||||||
++ (with hosts.hetzner-arm.profiles; [
|
++ (with hosts.hetzner-arm.profiles; [
|
||||||
staticSites
|
staticSites
|
||||||
|
|
|
@ -41,6 +41,7 @@ in
|
||||||
bat
|
bat
|
||||||
nix
|
nix
|
||||||
vault-bin
|
vault-bin
|
||||||
|
nix-output-monitor
|
||||||
])
|
])
|
||||||
++ (with self.packages."${system}"; [
|
++ (with self.packages."${system}"; [
|
||||||
mk-enc-usb
|
mk-enc-usb
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
in {
|
in {
|
||||||
|
environment.systemPackages = with pkgs; [ nix-output-monitor ];
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
|
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
|
||||||
extraOptions =
|
extraOptions =
|
||||||
|
|
Loading…
Reference in a new issue